@storm-software/k8s-tools 0.28.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +1 -1
  3. package/package.json +15 -39
  4. package/.eslintrc.json +0 -35
  5. package/executors.ts +0 -4
  6. package/generators.ts +0 -4
  7. package/index.ts +0 -5
  8. package/project.json +0 -61
  9. package/src/executors/container-publish/executor.spec.ts +0 -18
  10. package/src/executors/container-publish/executor.ts +0 -216
  11. package/src/executors/helm-package/executor.ts +0 -71
  12. package/src/generators/helm-chart/files/chart/.helmignore +0 -23
  13. package/src/generators/helm-chart/generator.ts +0 -69
  14. package/src/generators/helm-dependency/generator.ts +0 -135
  15. package/src/plugins/docker/_dockerfile.ts +0 -225
  16. package/src/plugins/docker/index.ts +0 -1
  17. package/src/plugins/index.ts +0 -1
  18. package/src/types.ts +0 -37
  19. package/src/utils/client.ts +0 -141
  20. package/src/utils/ensure-init.ts +0 -37
  21. package/src/utils/index.ts +0 -3
  22. package/src/utils/prettier.ts +0 -62
  23. package/tsconfig.json +0 -31
  24. package/tsup.config.ts +0 -26
  25. /package/{src → dist/src}/executors/container-publish/schema.d.ts +0 -0
  26. /package/{src → dist/src}/executors/container-publish/schema.json +0 -0
  27. /package/{src → dist/src}/executors/helm-package/schema.d.ts +0 -0
  28. /package/{src → dist/src}/executors/helm-package/schema.json +0 -0
  29. /package/{src → dist/src}/generators/helm-chart/files/chart/Chart.yaml.template +0 -0
  30. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/NOTES.txt +0 -0
  31. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/_helpers.yaml +0 -0
  32. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/deployment.yaml +0 -0
  33. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/hpa.yaml +0 -0
  34. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/ingress.yaml +0 -0
  35. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/service.yaml +0 -0
  36. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/serviceaccount.yaml +0 -0
  37. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/test/test-connection.yaml +0 -0
  38. /package/{src → dist/src}/generators/helm-chart/files/chart/values.yaml +0 -0
  39. /package/{src → dist/src}/generators/helm-chart/schema.d.ts +0 -0
  40. /package/{src → dist/src}/generators/helm-chart/schema.json +0 -0
  41. /package/{src → dist/src}/generators/helm-dependency/schema.d.ts +0 -0
  42. /package/{src → dist/src}/generators/helm-dependency/schema.json +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,53 @@
2
2
 
3
3
  # Changelog for Storm Ops - K8s Tools
4
4
 
5
+ ## [0.29.0](https://github.com/storm-software/storm-ops/releases/tag/k8s-tools%400.29.0) (2025-05-06)
6
+
7
+ ### Features
8
+
9
+ - **workspace-tools:** Update the release executor to replace workspace
10
+ configurations
11
+ ([7d2aa456c](https://github.com/storm-software/storm-ops/commit/7d2aa456c))
12
+
13
+ ### Miscellaneous
14
+
15
+ - **monorepo:** Update the workspace dependency links
16
+ ([a2b0947a3](https://github.com/storm-software/storm-ops/commit/a2b0947a3))
17
+ - **monorepo:** Regenerate README markdown files
18
+ ([96f241a4d](https://github.com/storm-software/storm-ops/commit/96f241a4d))
19
+ - **monorepo:** Regenerate README markdown files
20
+ ([17bbe7e16](https://github.com/storm-software/storm-ops/commit/17bbe7e16))
21
+
22
+ ### Updated Dependencies
23
+
24
+ - Updated workspace-tools to 1.271.0
25
+ - Updated workspace-tools to 1.271.0
26
+ - Updated config-tools to 1.167.0
27
+ - Updated config-tools to 1.167.0
28
+ - Updated config to 1.117.0
29
+ - Updated config to 1.117.0
30
+
31
+ ## [0.28.2](https://github.com/storm-software/storm-ops/releases/tag/k8s-tools%400.28.2) (2025-05-06)
32
+
33
+ ### Bug Fixes
34
+
35
+ - **workspace-tools:** Resolve issue with import path in executor
36
+ ([ddad2fdc8](https://github.com/storm-software/storm-ops/commit/ddad2fdc8))
37
+
38
+ ### Miscellaneous
39
+
40
+ - **monorepo:** Regenerate README markdown files
41
+ ([7e0751c3d](https://github.com/storm-software/storm-ops/commit/7e0751c3d))
42
+
43
+ ### Updated Dependencies
44
+
45
+ - Updated workspace-tools to 1.270.2
46
+ - Updated workspace-tools to 1.270.2
47
+ - Updated config-tools to 1.166.2
48
+ - Updated config-tools to 1.166.2
49
+ - Updated config to 1.116.2
50
+ - Updated config to 1.116.2
51
+
5
52
  ## [0.28.1](https://github.com/storm-software/storm-ops/releases/tag/k8s-tools%400.28.1) (2025-05-06)
6
53
 
7
54
  ### Bug Fixes
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.27.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.28.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/k8s-tools",
3
- "version": "0.28.1",
3
+ "version": "0.29.0",
4
4
  "description": "Tools for managing Kubernetes (k8s) infrastructure within a Nx workspace.",
5
5
  "repository": {
6
6
  "type": "github",
@@ -31,28 +31,16 @@
31
31
  "types": "./dist/index.d.mts",
32
32
  "default": "./dist/index.mjs"
33
33
  },
34
- "require": {
35
- "types": "./dist/index.d.ts",
36
- "default": "./dist/index.js"
37
- },
38
- "default": {
39
- "types": "./dist/index.d.ts",
40
- "default": "./dist/index.js"
41
- }
34
+ "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
35
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
42
36
  },
43
37
  "./index": {
44
38
  "import": {
45
39
  "types": "./dist/index.d.mts",
46
40
  "default": "./dist/index.mjs"
47
41
  },
48
- "require": {
49
- "types": "./dist/index.d.ts",
50
- "default": "./dist/index.js"
51
- },
52
- "default": {
53
- "types": "./dist/index.d.ts",
54
- "default": "./dist/index.js"
55
- }
42
+ "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
43
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
56
44
  },
57
45
  "./executors": {
58
46
  "import": {
@@ -145,26 +133,16 @@
145
133
  "tsup": "8.4.0"
146
134
  },
147
135
  "peerDependenciesMeta": {
148
- "@nx-tools/container-metadata": {
149
- "optional": false
150
- },
151
- "@nx-tools/nx-container": {
152
- "optional": false
153
- },
154
- "@nx/devkit": {
155
- "optional": false
156
- },
157
- "@nx/workspace": {
158
- "optional": false
159
- },
160
- "nx": {
161
- "optional": false
162
- }
136
+ "@nx-tools/container-metadata": { "optional": false },
137
+ "@nx-tools/nx-container": { "optional": false },
138
+ "@nx/devkit": { "optional": false },
139
+ "@nx/workspace": { "optional": false },
140
+ "nx": { "optional": false }
163
141
  },
164
142
  "dependencies": {
165
- "@storm-software/config": "1.116.1",
166
- "@storm-software/config-tools": "1.166.1",
167
- "@storm-software/workspace-tools": "1.270.1",
143
+ "@storm-software/config": "^1.117.1",
144
+ "@storm-software/config-tools": "^1.167.1",
145
+ "@storm-software/workspace-tools": "^1.271.1",
168
146
  "js-yaml": "^4.1.0"
169
147
  },
170
148
  "devDependencies": {
@@ -179,9 +157,7 @@
179
157
  "typescript": "^5.8.3",
180
158
  "untyped": "^1.5.2"
181
159
  },
182
- "publishConfig": {
183
- "access": "public"
184
- },
160
+ "publishConfig": { "access": "public" },
185
161
  "executors": "./executors.json",
186
162
  "generators": "./generators.json"
187
- }
163
+ }
package/.eslintrc.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "extends": ["../../.eslintrc.json"],
3
- "ignorePatterns": ["!**/*"],
4
- "overrides": [
5
- {
6
- "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
- "parserOptions": {
8
- "project": ["packages/k8s-tools/tsconfig.*?.json"]
9
- },
10
- "rules": {}
11
- },
12
- {
13
- "files": ["*.ts", "*.tsx"],
14
- "rules": {}
15
- },
16
- {
17
- "files": ["*.js", "*.jsx"],
18
- "rules": {}
19
- },
20
- {
21
- "files": ["*.json"],
22
- "parser": "jsonc-eslint-parser",
23
- "rules": {
24
- "@nx/dependency-checks": "error"
25
- }
26
- },
27
- {
28
- "files": ["./package.json", "./executors.json", "./generators.json"],
29
- "parser": "jsonc-eslint-parser",
30
- "rules": {
31
- "@nx/nx-plugin-checks": "error"
32
- }
33
- }
34
- ]
35
- }
package/executors.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./src/executors/container-publish/executor";
2
- export { type ContainerPublishExecutorSchema } from "./src/executors/container-publish/schema.d";
3
- export * from "./src/executors/helm-package/executor";
4
- export { type HelmPackageExecutorSchema } from "./src/executors/helm-package/schema.d";
package/generators.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./src/generators/helm-chart/generator";
2
- export { type HelmChartGeneratorSchema } from "./src/generators/helm-chart/schema.d";
3
- export * from "./src/generators/helm-dependency/generator";
4
- export { type HelmDependencyGeneratorSchema } from "./src/generators/helm-dependency/schema.d";
package/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from "./executors";
2
- export * from "./generators";
3
- export * from "./src/plugins";
4
- export * from "./src/types";
5
- export * from "./src/utils";
package/project.json DELETED
@@ -1,61 +0,0 @@
1
- {
2
- "name": "k8s-tools",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/k8s-tools/src",
5
- "projectType": "library",
6
- "implicitDependencies": [
7
- "workspace-tools",
8
- "untyped",
9
- "config-tools",
10
- "config"
11
- ],
12
- "targets": {
13
- "build-untyped": {
14
- "executor": "nx:run-commands",
15
- "dependsOn": ["clean", "^build"],
16
- "inputs": [
17
- "{projectRoot}/src/**/untyped.ts",
18
- "{projectRoot}/src/**/*.untyped.ts"
19
- ],
20
- "outputs": [
21
- "{projectRoot}/src/**/schema.d.ts",
22
- "{projectRoot}/src/**/*.schema.d.ts",
23
- "{projectRoot}/src/**/schema.md",
24
- "{projectRoot}/src/**/*.schema.md",
25
- "{projectRoot}/src/**/schema.json",
26
- "{projectRoot}/src/**/*.schema.json"
27
- ],
28
- "options": {
29
- "commands": [
30
- "node dist/packages/untyped/bin/untyped.cjs generate --entry=\"packages/k8s-tools/**/{untyped.ts,*.untyped.ts}\" "
31
- ]
32
- }
33
- },
34
- "build-base": {
35
- "executor": "nx:run-commands",
36
- "dependsOn": ["build-untyped", "clean", "^build"],
37
- "options": {
38
- "command": "tsup-node --config=tsup.config.ts",
39
- "cwd": "{projectRoot}"
40
- }
41
- },
42
- "build": {
43
- "executor": "nx:run-commands",
44
- "dependsOn": ["build-base", "build-untyped"],
45
- "options": {
46
- "commands": [
47
- "pnpm copyfiles LICENSE dist/packages/k8s-tools",
48
- "pnpm copyfiles --up=2 ./packages/k8s-tools/*.md ./packages/k8s-tools/executors.json ./packages/k8s-tools/generators.json ./packages/k8s-tools/package.json dist/packages/k8s-tools",
49
- "pnpm copyfiles --up=3 \"./packages/k8s-tools/dist/**/*\" dist/packages/k8s-tools/dist",
50
- "pnpm copyfiles --up=3 \"./packages/k8s-tools/src/**/*schema.d.ts\" dist/packages/k8s-tools/dist/src",
51
- "pnpm copyfiles --up=3 \"./packages/k8s-tools/src/**/*schema.json\" dist/packages/k8s-tools/dist/src",
52
- "pnpm copyfiles --up=3 \"./packages/k8s-tools/src/**/*.md\" dist/packages/k8s-tools/docs/api",
53
- "pnpm copyfiles --up=4 \"./packages/k8s-tools/src/generators/*/files/**/*\" dist/packages/k8s-tools/dist/src/generators"
54
- ]
55
- }
56
- },
57
- "nx-release-publish": {
58
- "executor": "@storm-software/workspace-tools:npm-publish"
59
- }
60
- }
61
- }
@@ -1,18 +0,0 @@
1
- import { ExecutorContext } from "@nx/devkit";
2
-
3
- import executor from "./executor";
4
- import { ContainerPublishExecutorSchema } from "./schema";
5
-
6
- const options: ContainerPublishExecutorSchema = {};
7
- const context: ExecutorContext = {
8
- root: "",
9
- cwd: process.cwd(),
10
- isVerbose: false,
11
- };
12
-
13
- describe("ContainerPublish Executor", () => {
14
- it("can run", async () => {
15
- const output = await executor(options, context);
16
- expect(output.success).toBe(true);
17
- });
18
- });
@@ -1,216 +0,0 @@
1
- import {
2
- parseTargetString,
3
- runExecutor,
4
- type ExecutorContext
5
- } from "@nx/devkit";
6
- import { StormWorkspaceConfig } from "@storm-software/config";
7
- import {
8
- applyWorkspaceTokens,
9
- findWorkspaceRoot,
10
- getConfig,
11
- type BaseTokenizerOptions
12
- } from "@storm-software/config-tools";
13
- import { applyWorkspaceExecutorTokens } from "@storm-software/workspace-tools/utils/apply-workspace-tokens";
14
- import { getPackageInfo } from "@storm-software/workspace-tools/utils/package-helpers";
15
- import { CargoToml } from "@storm-software/workspace-tools/utils/toml";
16
- import https from "node:https";
17
- import type { ContainerPublishExecutorSchema } from "./schema.d";
18
-
19
- export default async function* publishExecutor(
20
- options: ContainerPublishExecutorSchema,
21
- context: ExecutorContext
22
- ) {
23
- /**
24
- * We need to check both the env var and the option because the executor may have been triggered
25
- * indirectly via dependsOn, in which case the env var will be set, but the option will not.
26
- */
27
- const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
28
-
29
- if (!context.projectName) {
30
- throw new Error("The executor requires a projectName.");
31
- }
32
-
33
- console.info(
34
- `🚀 Running Storm Container Registry Publish executor on the ${context.projectName} crate`
35
- );
36
-
37
- const workspaceRoot = findWorkspaceRoot();
38
- const config = await getConfig(workspaceRoot);
39
-
40
- const projectConfig =
41
- context.projectsConfigurations?.projects[context.projectName];
42
- if (!projectConfig) {
43
- throw new Error(
44
- `The executor requires a valid projectsConfiguration - No configuration found for project ${context.projectName}`
45
- );
46
- }
47
-
48
- const projectRoot = projectConfig?.root ?? workspaceRoot;
49
- const sourceRoot = projectConfig?.sourceRoot ?? workspaceRoot;
50
- const projectName = projectConfig?.name ?? context.projectName;
51
- config.workspaceRoot = workspaceRoot;
52
-
53
- const tokenized = (await applyWorkspaceTokens(
54
- options,
55
- {
56
- config,
57
- workspaceRoot,
58
- projectRoot,
59
- sourceRoot,
60
- projectName,
61
- ...projectConfig
62
- } as BaseTokenizerOptions,
63
- applyWorkspaceExecutorTokens
64
- )) as ContainerPublishExecutorSchema;
65
-
66
- tokenized.engine ??= "docker";
67
- tokenized.registry ??= config.registry.container;
68
-
69
- try {
70
- if (isDryRun) {
71
- console.log(
72
- `Would publish to ${tokenized.registry}, but [dry-run] was set`
73
- );
74
- } else {
75
- console.log(`Published to ${tokenized.registry}`);
76
-
77
- const packageManager = getPackageInfo(projectConfig);
78
- if (packageManager) {
79
- tokenized["build-args"] ??= [
80
- "ENVIRONMENT=production",
81
- "DEBUG_IMAGE=false"
82
- ];
83
- tokenized["labels"] ??= [];
84
-
85
- let version = "";
86
- if (process.env.TAG) {
87
- version = process.env.TAG;
88
- } else {
89
- if (packageManager.type === "Cargo.toml") {
90
- version = (packageManager.content as CargoToml).package.version;
91
- } else if (packageManager.type === "package.json") {
92
- version = packageManager.content.version;
93
- }
94
- }
95
-
96
- tokenized["build-args"].push(`RELEASE=${version}`);
97
- tokenized["labels"].push(`org.opencontainers.image.version=${version}`);
98
-
99
- const tags = await getRegistryVersion(projectName, config);
100
- if (tags.length === 0) {
101
- tokenized["labels"].push(
102
- `org.opencontainers.image.created=${new Date().toISOString()}`
103
- );
104
- } else if (tags.includes(version)) {
105
- console.warn(
106
- `Skipped package "${projectName}" because v${version} already exists in ${tokenized.registry}`
107
- );
108
- return {
109
- success: true
110
- };
111
- }
112
- } else {
113
- console.warn(
114
- `No package manager found for project "${projectName}" - Skipping container publishing`
115
- );
116
- return {
117
- success: true
118
- };
119
- }
120
-
121
- const { project, target, configuration } = parseTargetString(
122
- "container",
123
- context
124
- );
125
- for await (const output of await runExecutor<{
126
- success: boolean;
127
- baseUrl?: string;
128
- }>({ project, target, configuration }, tokenized, context)) {
129
- if (!output.success) {
130
- throw new Error("Could not compile application files");
131
- }
132
- yield;
133
- }
134
- }
135
-
136
- return {
137
- success: true
138
- };
139
- } catch (error: any) {
140
- console.error(`Failed to publish to ${tokenized.registry}`);
141
- console.error(error);
142
- console.log("");
143
-
144
- return {
145
- success: false
146
- };
147
- }
148
- }
149
-
150
- export const getRegistryVersion = (
151
- name: string,
152
- config: StormWorkspaceConfig
153
- ): Promise<string[]> => {
154
- if (!name) {
155
- throw new Error(
156
- "The `getRegistryVersion` function requires a container name."
157
- );
158
- }
159
-
160
- try {
161
- const tagsApiUrl = `${config.registry.container}/v2/namespaces/${encodeURIComponent(config.namespace ? config.namespace : "storm-software")}/repositories/${encodeURIComponent(
162
- name.replace(`${config.namespace}-`, "")
163
- )}/tags`;
164
- console.log(`Checking for existing version at ${tagsApiUrl}`);
165
-
166
- return new Promise(
167
- (resolve: (value: string[]) => void, reject: (error: any) => void) =>
168
- https
169
- .get(tagsApiUrl, res => {
170
- if (res.statusCode === 404) {
171
- console.log(`No existing version found at ${tagsApiUrl}`);
172
- return resolve([] as string[]);
173
- }
174
-
175
- res.on("data", data => {
176
- if (data) {
177
- console.log(
178
- `Existing versions found at ${tagsApiUrl} - ${data}`
179
- );
180
- const json = JSON.parse(data.toString());
181
- return resolve(
182
- json.results
183
- .filter(
184
- (result: { status: string; name: string }) =>
185
- result.status === "active" &&
186
- result.name &&
187
- result.name !== "latest"
188
- )
189
- .map((result: { name: string }) => result.name)
190
- );
191
- }
192
-
193
- return reject(
194
- new Error(
195
- "No data returned from container registry, expected a 404 if no tags exist"
196
- )
197
- );
198
- });
199
- })
200
- .on("error", e => {
201
- throw e;
202
- })
203
- );
204
- } catch (error) {
205
- console.error(`Failed to get version from ${config.registry.container}`);
206
- console.error(error);
207
- console.log("");
208
-
209
- throw new Error(
210
- `Could not get version from container registry - ${config.registry.container}`,
211
- {
212
- cause: error
213
- }
214
- );
215
- }
216
- };
@@ -1,71 +0,0 @@
1
- import type { ExecutorContext, PromiseExecutor } from "@nx/devkit";
2
- import type { StormWorkspaceConfig } from "@storm-software/config";
3
- import { writeWarning } from "@storm-software/config-tools/logger/console";
4
- import { withRunExecutor } from "@storm-software/workspace-tools/base/base-executor";
5
- import { createHelmClient } from "../../utils/client";
6
- import { HelmPackageExecutorSchema } from "./schema";
7
-
8
- export async function serveExecutor(
9
- options: HelmPackageExecutorSchema,
10
- context: ExecutorContext,
11
- config?: StormWorkspaceConfig
12
- ) {
13
- if (
14
- !context?.projectName ||
15
- !context?.projectsConfigurations?.projects?.[context.projectName]?.root
16
- ) {
17
- throw new Error("Nx executor context was invalid");
18
- }
19
-
20
- const helm = createHelmClient();
21
- if (options.dependencies?.repositories) {
22
- for (const repository of options.dependencies.repositories) {
23
- if (repository.name && repository.url) {
24
- helm.addRepository(repository.name, repository.url);
25
- } else {
26
- throw new Error("Repository name and url are required");
27
- }
28
- }
29
- }
30
-
31
- if (options.dependencies?.update) {
32
- helm.dependencyUpdate(options.chartFolder);
33
- }
34
-
35
- if (options.dependencies?.build) {
36
- helm.dependencyBuild(options.chartFolder);
37
- }
38
-
39
- const chartPath = await helm.package({
40
- chartFolder: options.chartFolder,
41
- outputFolder: options.outputFolder
42
- });
43
-
44
- if (options.push && chartPath && options.remote) {
45
- helm.push({
46
- chartPath,
47
- remote: options.remote
48
- });
49
- } else {
50
- writeWarning(`Chart packaged at: ${chartPath}`, config);
51
- }
52
-
53
- return {
54
- success: true
55
- };
56
- }
57
-
58
- export default withRunExecutor<HelmPackageExecutorSchema>(
59
- "Helm Chart Package executor",
60
- serveExecutor,
61
- {
62
- skipReadingConfig: false,
63
- hooks: {
64
- applyDefaultOptions: (options: HelmPackageExecutorSchema) => {
65
- options.port ??= 4500;
66
-
67
- return options as HelmPackageExecutorSchema;
68
- }
69
- }
70
- }
71
- ) as PromiseExecutor<HelmPackageExecutorSchema>;
@@ -1,23 +0,0 @@
1
- # Patterns to ignore when building packages.
2
- # This supports shell glob matching, relative path matching, and
3
- # negation (prefixed with !). Only one pattern per line.
4
- .DS_Store
5
- # Common VCS dirs
6
- .git/
7
- .gitignore
8
- .bzr/
9
- .bzrignore
10
- .hg/
11
- .hgignore
12
- .svn/
13
- # Common backup files
14
- *.swp
15
- *.bak
16
- *.tmp
17
- *.orig
18
- *~
19
- # Various IDEs
20
- .project
21
- .idea/
22
- *.tmproj
23
- .vscode/
@@ -1,69 +0,0 @@
1
- import {
2
- formatFiles,
3
- generateFiles,
4
- readProjectConfiguration,
5
- Tree,
6
- updateProjectConfiguration
7
- } from "@nx/devkit";
8
- import { StormWorkspaceConfig } from "@storm-software/config";
9
- import { writeDebug } from "@storm-software/config-tools/logger/console";
10
- import { withRunGenerator } from "@storm-software/workspace-tools/base/base-generator";
11
- import { join } from "path";
12
- import type { HelmChartGeneratorSchema } from "./schema";
13
-
14
- export async function helmChartGeneratorFn(
15
- tree: Tree,
16
- options: HelmChartGeneratorSchema,
17
- config?: StormWorkspaceConfig
18
- ) {
19
- writeDebug("📝 Preparing to write Helm Chart", config);
20
-
21
- const project = readProjectConfiguration(tree, options.project);
22
- if (project.targets?.["helm-package"]) {
23
- throw new Error(
24
- `Project ${options.project} already has a helm target. Please remove it before running this command.`
25
- );
26
- }
27
-
28
- updateProjectConfiguration(tree, options.project, {
29
- ...project,
30
- targets: {
31
- ...project.targets,
32
- "helm-package": {
33
- executor: "@storm-software/k8s-tools:helm-package",
34
- outputs: ["{options.outputFolder}"],
35
- options: {
36
- chartFolder: `${project.root}/${options.chartFolder}`,
37
- outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
38
- push: false,
39
- remote: "oci://localhost:5000/helm-charts",
40
- dependencies: {
41
- update: true,
42
- build: true,
43
- repositories: []
44
- }
45
- }
46
- }
47
- }
48
- });
49
-
50
- generateFiles(
51
- tree,
52
- join(__dirname, "files", "chart"),
53
- join(project.root, options.chartFolder ?? ""),
54
- options
55
- );
56
-
57
- if (options.format) {
58
- await formatFiles(tree);
59
- }
60
-
61
- return {
62
- success: true
63
- };
64
- }
65
-
66
- export default withRunGenerator<HelmChartGeneratorSchema>(
67
- "Helm Chart",
68
- helmChartGeneratorFn
69
- );