Skip to content

Commit

Permalink
Don’t enforce that values.yaml must exist in a chart
Browse files Browse the repository at this point in the history
  • Loading branch information
nktpro committed Feb 10, 2024
1 parent 7bfe023 commit 9907a05
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 83 deletions.
86 changes: 43 additions & 43 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 15 additions & 17 deletions src/actions/typeify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,26 +461,24 @@ async function readChartValues(

const valuesPath = joinPath(chartPath, "values.yaml");

if (!await fsExists(valuesPath)) {
throw new Error(
`Expected a 'values.yaml' file inside the Helm chart directory but none is found at ${valuesPath}`,
);
}
let values: Record<string, unknown> = {};

const raw = await Deno.readTextFile(valuesPath);
if (await fsExists(valuesPath)) {
const raw = await Deno.readTextFile(valuesPath);

const parsed = (() => {
try {
return parseYaml(raw);
} catch (e) {
console.warn(
`Failed parsing ${valuesPath}, going types ignore it. Reason: ${e.message}`,
);
return {};
}
})();
const parsed = (() => {
try {
return parseYaml(raw);
} catch (e) {
console.warn(
`Failed parsing ${valuesPath}, going types ignore it. Reason: ${e.message}`,
);
return {};
}
})();

const values = (typeof parsed === "object" && parsed !== null) ? parsed as Record<string, unknown> : {};
values = (typeof parsed === "object" && parsed !== null) ? parsed as Record<string, unknown> : {};
}

return deepMerge(baseValues, values);
}
Expand Down
2 changes: 1 addition & 1 deletion src/deps/async_utils.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/utils@2.18.1/async_utils.ts";
export * from "https://deno.land/x/utils@2.18.6/async_utils.ts";
2 changes: 1 addition & 1 deletion src/deps/cli_utils.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/utils@2.18.1/cli_utils.ts";
export * from "https://deno.land/x/utils@2.18.6/cli_utils.ts";
2 changes: 1 addition & 1 deletion src/deps/exec_utils.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/utils@2.18.1/exec_utils.ts";
export * from "https://deno.land/x/utils@2.18.6/exec_utils.ts";
2 changes: 1 addition & 1 deletion src/deps/k8s_utils.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/utils@2.18.1/k8s_utils.ts";
export * from "https://deno.land/x/utils@2.18.6/k8s_utils.ts";
2 changes: 1 addition & 1 deletion src/deps/typebox.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/utils@2.18.1/deps/typebox.ts";
export * from "https://deno.land/x/utils@2.18.6/deps/typebox.ts";
4 changes: 2 additions & 2 deletions src/deps/validation_utils.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "https://deno.land/x/utils@2.18.1/validation_utils.ts";
export type { ValidationResult } from "https://deno.land/x/utils@2.18.1/validation_utils.ts";
export * from "https://deno.land/x/utils@2.18.6/validation_utils.ts";
export type { ValidationResult } from "https://deno.land/x/utils@2.18.6/validation_utils.ts";

0 comments on commit 9907a05

Please sign in to comment.