mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix HelmChart validator requiring digest field
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
625b00c247
commit
e939968470
26
src/common/k8s-api/__tests__/helm-charts.test.ts
Normal file
26
src/common/k8s-api/__tests__/helm-charts.test.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { HelmChart } from "../endpoints/helm-charts.api";
|
||||
|
||||
describe("Helm Charts", () => {
|
||||
it("should accept a helm chart without a digest field", () => {
|
||||
expect(() => HelmChart.create({
|
||||
apiVersion: "foo",
|
||||
name: "bar",
|
||||
version: "1.0.0",
|
||||
repo: "localhost:9090",
|
||||
created: "yesterday",
|
||||
description: "my bar chart",
|
||||
keywords: ["test"],
|
||||
sources: [],
|
||||
urls: [],
|
||||
annotations: {},
|
||||
dependencies: [],
|
||||
maintainers: [],
|
||||
deprecated: false,
|
||||
})).not.toThrowError();
|
||||
});
|
||||
});
|
||||
@ -75,7 +75,7 @@ export interface RawHelmChart {
|
||||
version: string;
|
||||
repo: string;
|
||||
created: string;
|
||||
digest: string;
|
||||
digest?: string;
|
||||
kubeVersion?: string;
|
||||
description?: string;
|
||||
home?: string;
|
||||
@ -142,7 +142,7 @@ const helmChartValidator = Joi.object<HelmChart, true, RawHelmChart>({
|
||||
.required(),
|
||||
digest: Joi
|
||||
.string()
|
||||
.required(),
|
||||
.optional(),
|
||||
kubeVersion: Joi
|
||||
.string()
|
||||
.optional(),
|
||||
@ -247,22 +247,22 @@ export interface HelmChart {
|
||||
name: string;
|
||||
version: string;
|
||||
repo: string;
|
||||
kubeVersion?: string;
|
||||
created: string;
|
||||
description: string;
|
||||
digest: string;
|
||||
keywords: string[];
|
||||
home?: string;
|
||||
sources: string[];
|
||||
urls: string[];
|
||||
annotations: Record<string, string>;
|
||||
dependencies: HelmChartDependency[];
|
||||
maintainers: HelmChartMaintainer[];
|
||||
deprecated: boolean;
|
||||
kubeVersion?: string;
|
||||
digest?: string;
|
||||
home?: string;
|
||||
engine?: string;
|
||||
icon?: string;
|
||||
appVersion?: string;
|
||||
type?: string;
|
||||
deprecated: boolean;
|
||||
tillerVersion?: string;
|
||||
}
|
||||
|
||||
@ -324,7 +324,11 @@ export class HelmChart {
|
||||
}
|
||||
|
||||
getId(): string {
|
||||
return `${this.repo}:${this.apiVersion}/${this.name}@${this.getAppVersion()}+${this.digest}`;
|
||||
const digestPart = this.digest
|
||||
? `+${this.digest}`
|
||||
: "";
|
||||
|
||||
return `${this.repo}:${this.apiVersion}/${this.name}@${this.getAppVersion()}${digestPart}`;
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user