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;
|
version: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
created: string;
|
created: string;
|
||||||
digest: string;
|
digest?: string;
|
||||||
kubeVersion?: string;
|
kubeVersion?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
home?: string;
|
home?: string;
|
||||||
@ -142,7 +142,7 @@ const helmChartValidator = Joi.object<HelmChart, true, RawHelmChart>({
|
|||||||
.required(),
|
.required(),
|
||||||
digest: Joi
|
digest: Joi
|
||||||
.string()
|
.string()
|
||||||
.required(),
|
.optional(),
|
||||||
kubeVersion: Joi
|
kubeVersion: Joi
|
||||||
.string()
|
.string()
|
||||||
.optional(),
|
.optional(),
|
||||||
@ -247,22 +247,22 @@ export interface HelmChart {
|
|||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
kubeVersion?: string;
|
|
||||||
created: string;
|
created: string;
|
||||||
description: string;
|
description: string;
|
||||||
digest: string;
|
|
||||||
keywords: string[];
|
keywords: string[];
|
||||||
home?: string;
|
|
||||||
sources: string[];
|
sources: string[];
|
||||||
urls: string[];
|
urls: string[];
|
||||||
annotations: Record<string, string>;
|
annotations: Record<string, string>;
|
||||||
dependencies: HelmChartDependency[];
|
dependencies: HelmChartDependency[];
|
||||||
maintainers: HelmChartMaintainer[];
|
maintainers: HelmChartMaintainer[];
|
||||||
|
deprecated: boolean;
|
||||||
|
kubeVersion?: string;
|
||||||
|
digest?: string;
|
||||||
|
home?: string;
|
||||||
engine?: string;
|
engine?: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
appVersion?: string;
|
appVersion?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
deprecated: boolean;
|
|
||||||
tillerVersion?: string;
|
tillerVersion?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +324,11 @@ export class HelmChart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getId(): string {
|
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 {
|
getName(): string {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user