@otwld/nx-helm 0.0.2
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.
- package/README.md +134 -0
- package/executors.json +21 -0
- package/generators.json +17 -0
- package/package.json +38 -0
- package/src/chart-manifest.d.ts +22 -0
- package/src/chart-manifest.js +57 -0
- package/src/chart-manifest.js.map +1 -0
- package/src/executors/package/package.d.ts +10 -0
- package/src/executors/package/package.js +59 -0
- package/src/executors/package/package.js.map +1 -0
- package/src/executors/package/schema.d.ts +7 -0
- package/src/executors/package/schema.json +18 -0
- package/src/executors/project-directory.d.ts +8 -0
- package/src/executors/project-directory.js +24 -0
- package/src/executors/project-directory.js.map +1 -0
- package/src/executors/release-publish/release-publish.d.ts +10 -0
- package/src/executors/release-publish/release-publish.js +106 -0
- package/src/executors/release-publish/release-publish.js.map +1 -0
- package/src/executors/release-publish/schema.d.ts +9 -0
- package/src/executors/release-publish/schema.json +22 -0
- package/src/executors/run-helm.d.ts +7 -0
- package/src/executors/run-helm.js +33 -0
- package/src/executors/run-helm.js.map +1 -0
- package/src/executors/validate/schema.d.ts +11 -0
- package/src/executors/validate/schema.json +29 -0
- package/src/executors/validate/validate.d.ts +16 -0
- package/src/executors/validate/validate.js +53 -0
- package/src/executors/validate/validate.js.map +1 -0
- package/src/generators/chart/chart.d.ts +10 -0
- package/src/generators/chart/chart.js +106 -0
- package/src/generators/chart/chart.js.map +1 -0
- package/src/generators/chart/schema.d.ts +11 -0
- package/src/generators/chart/schema.json +36 -0
- package/src/generators/init/init.d.ts +9 -0
- package/src/generators/init/init.js +136 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +15 -0
- package/src/generators/init/schema.json +41 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +10 -0
- package/src/index.js.map +1 -0
- package/src/plugins/plugin.d.ts +34 -0
- package/src/plugins/plugin.js +214 -0
- package/src/plugins/plugin.js.map +1 -0
- package/src/release/version-actions.d.ts +67 -0
- package/src/release/version-actions.js +131 -0
- package/src/release/version-actions.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# @otwld/nx-helm
|
|
2
|
+
|
|
3
|
+
Nx generator, inferred-task plugin, and executors for standalone Helm charts.
|
|
4
|
+
Helm owns chart files; Nx owns the project boundary and task graph.
|
|
5
|
+
|
|
6
|
+
## Generate a chart
|
|
7
|
+
|
|
8
|
+
Initialize the plugin once per workspace:
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
pnpm exec nx add @otwld/nx-helm
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This runs the hidden `init` generator, registers the plugin in `nx.json`, and
|
|
15
|
+
adds missing shared target defaults without replacing existing configuration.
|
|
16
|
+
|
|
17
|
+
Create a chart afterward:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
pnpm exec nx g @otwld/nx-helm:chart backend
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The generator runs `helm create` in a temporary directory, imports Helm's
|
|
24
|
+
generated files into the workspace, and adds only this project marker:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
charts/backend/
|
|
28
|
+
├── Chart.yaml
|
|
29
|
+
├── templates/
|
|
30
|
+
├── values.yaml
|
|
31
|
+
└── project.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Generated projects use the `helm-<name>` project name and
|
|
35
|
+
`scope:workspace`, `layer:infra`, and `runtime:helm` tags. Generator options are
|
|
36
|
+
`directory`, `projectName`, and `starter`; `starter` is passed to Helm as
|
|
37
|
+
`helm create --starter`.
|
|
38
|
+
|
|
39
|
+
Helm's built-in scaffold is the default. Chart metadata and chart files are not
|
|
40
|
+
duplicated in this plugin.
|
|
41
|
+
|
|
42
|
+
## Inferred targets
|
|
43
|
+
|
|
44
|
+
The plugin scans `**/Chart.yaml` and contributes targets only when the file has
|
|
45
|
+
a sibling `project.json`. This keeps nested Helm subcharts and app-owned
|
|
46
|
+
`helm/` directories out of the standalone chart graph.
|
|
47
|
+
|
|
48
|
+
- `nx run helm-backend:helm:validate` runs `helm lint` and `helm template`.
|
|
49
|
+
- `nx run helm-backend:helm:package` packages the root chart into `dist/charts/backend/helm`.
|
|
50
|
+
- `nx release publish` invokes the inferred `nx-release-publish` target.
|
|
51
|
+
|
|
52
|
+
The default validation release name is the Nx project name, such as
|
|
53
|
+
`helm-backend`. Set `options.validateTarget.releaseName` in `nx.json` only when
|
|
54
|
+
a workspace-wide override is required.
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
`nx add` writes this default plugin registration:
|
|
59
|
+
|
|
60
|
+
```jsonc
|
|
61
|
+
{
|
|
62
|
+
"plugins": [
|
|
63
|
+
{
|
|
64
|
+
"plugin": "@otwld/nx-helm",
|
|
65
|
+
"options": {
|
|
66
|
+
"validateTarget": {
|
|
67
|
+
"name": "helm:validate",
|
|
68
|
+
"kubeVersion": "1.32.0",
|
|
69
|
+
"strict": false,
|
|
70
|
+
},
|
|
71
|
+
"packageTarget": {
|
|
72
|
+
"name": "helm:package",
|
|
73
|
+
},
|
|
74
|
+
"registry": "oci://harbor.example.com/team",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`targetDefaults` in `nx.json` supplies shared cache inputs for the default
|
|
82
|
+
`helm:validate` and `helm:package` target names. Project-specific target
|
|
83
|
+
configuration can override inferred values when required.
|
|
84
|
+
|
|
85
|
+
## Nx Release
|
|
86
|
+
|
|
87
|
+
The `helm` release group selects projects with the `runtime:helm` tag and
|
|
88
|
+
versions them independently. Release tags use `helm/{projectName}/{version}`;
|
|
89
|
+
each project receives its own changelog. Nx Release updates only
|
|
90
|
+
`Chart.yaml.version`; `appVersion` remains application metadata.
|
|
91
|
+
|
|
92
|
+
```shell
|
|
93
|
+
pnpm exec nx release version patch --groups=helm --first-release --dry-run
|
|
94
|
+
pnpm exec nx release changelog 0.1.1 --groups=helm --first-release --dry-run
|
|
95
|
+
pnpm exec nx release publish --groups=helm --dry-run
|
|
96
|
+
pnpm exec nx release patch --groups=helm --first-release --dry-run --skip-publish
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Authenticate Helm before a real publish:
|
|
100
|
+
|
|
101
|
+
```shell
|
|
102
|
+
helm registry login harbor.otwld.com
|
|
103
|
+
pnpm exec nx release --groups=helm --first-release
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## npm Release
|
|
107
|
+
|
|
108
|
+
`@otwld/nx-helm` and `@otwld/nx-argo` are released independently to npm by the
|
|
109
|
+
`npm` release group. Nx derives bumps from Conventional Commits, builds both
|
|
110
|
+
packages before versioning, updates source and dist manifests, and publishes
|
|
111
|
+
from `dist/plugins/nx/{project}`.
|
|
112
|
+
|
|
113
|
+
Preview the first release:
|
|
114
|
+
|
|
115
|
+
```shell
|
|
116
|
+
pnpm exec nx release version --groups=npm --first-release --dry-run
|
|
117
|
+
pnpm exec nx release publish --groups=npm --first-release --dry-run --access=public
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Run a real release from an authenticated npm session:
|
|
121
|
+
|
|
122
|
+
```shell
|
|
123
|
+
pnpm exec nx release --groups=npm --first-release
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Release tags use `npm/{projectName}/{version}` and each package receives its
|
|
127
|
+
own changelog. Do not set a registry in `publishConfig`; use npm configuration
|
|
128
|
+
or the Nx `--registry` option when required.
|
|
129
|
+
|
|
130
|
+
## Plugin targets
|
|
131
|
+
|
|
132
|
+
- `nx build nx-helm` builds the plugin package.
|
|
133
|
+
- `nx lint nx-helm` runs ESLint through the workspace ESLint plugin.
|
|
134
|
+
- `nx test nx-helm` runs the plugin unit tests with Vitest.
|
package/executors.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"executors": {
|
|
4
|
+
"validate": {
|
|
5
|
+
"implementation": "./src/executors/validate/validate",
|
|
6
|
+
"schema": "./src/executors/validate/schema.json",
|
|
7
|
+
"description": "Validate the root Helm chart with lint and template"
|
|
8
|
+
},
|
|
9
|
+
"package": {
|
|
10
|
+
"implementation": "./src/executors/package/package",
|
|
11
|
+
"schema": "./src/executors/package/schema.json",
|
|
12
|
+
"description": "Package the root Helm chart into a versioned archive"
|
|
13
|
+
},
|
|
14
|
+
"release-publish": {
|
|
15
|
+
"implementation": "./src/executors/release-publish/release-publish",
|
|
16
|
+
"schema": "./src/executors/release-publish/schema.json",
|
|
17
|
+
"description": "DO NOT INVOKE DIRECTLY WITH `nx run`. Use `nx release publish` instead.",
|
|
18
|
+
"hidden": true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
package/generators.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"generators": {
|
|
4
|
+
"init": {
|
|
5
|
+
"factory": "./src/generators/init/init",
|
|
6
|
+
"schema": "./src/generators/init/schema.json",
|
|
7
|
+
"description": "Initialize the @otwld/nx-helm plugin.",
|
|
8
|
+
"aliases": ["ng-add"],
|
|
9
|
+
"hidden": true
|
|
10
|
+
},
|
|
11
|
+
"chart": {
|
|
12
|
+
"factory": "./src/generators/chart/chart",
|
|
13
|
+
"schema": "./src/generators/chart/schema.json",
|
|
14
|
+
"description": "Create a standalone Helm chart Nx project."
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@otwld/nx-helm",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"@nx/nx-source": "./src/index.ts",
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
10
|
+
"default": "./src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./release": {
|
|
13
|
+
"@nx/nx-source": "./src/release/version-actions.ts",
|
|
14
|
+
"types": "./src/release/version-actions.d.ts",
|
|
15
|
+
"default": "./src/release/version-actions.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
"./executors.json": "./executors.json",
|
|
19
|
+
"./generators.json": "./generators.json",
|
|
20
|
+
"./release/version-actions": "./src/release/version-actions.js"
|
|
21
|
+
},
|
|
22
|
+
"main": "./src/index.js",
|
|
23
|
+
"types": "./src/index.d.ts",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@nx/devkit": "23.1.1",
|
|
26
|
+
"semver": "^7.8.5",
|
|
27
|
+
"tslib": "^2.3.0",
|
|
28
|
+
"yaml": "^2.9.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"nx": ">=22 <=24 || ^23.0.0-0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"executors": "./executors.json",
|
|
37
|
+
"generators": "./generators.json"
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Metadata required to package and publish a Helm chart. */
|
|
2
|
+
export interface ChartMetadata {
|
|
3
|
+
/** The chart name used in the packaged archive name. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** The chart version used in the packaged archive name and OCI tag. */
|
|
6
|
+
version: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reads and validates the package metadata in a Chart.yaml document.
|
|
10
|
+
* @param content Chart.yaml contents.
|
|
11
|
+
* @param filePath Chart.yaml path used in validation errors.
|
|
12
|
+
* @returns The chart name and semantic version.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readChartMetadata(content: string, filePath: string): ChartMetadata;
|
|
15
|
+
/**
|
|
16
|
+
* Updates only the Chart.yaml version while retaining the document structure.
|
|
17
|
+
* @param content Chart.yaml contents.
|
|
18
|
+
* @param filePath Chart.yaml path used in validation errors.
|
|
19
|
+
* @param newVersion New semantic chart version.
|
|
20
|
+
* @returns Updated Chart.yaml contents.
|
|
21
|
+
*/
|
|
22
|
+
export declare function updateChartVersion(content: string, filePath: string, newVersion: string): string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readChartMetadata = readChartMetadata;
|
|
4
|
+
exports.updateChartVersion = updateChartVersion;
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const yaml_1 = require("yaml");
|
|
7
|
+
/**
|
|
8
|
+
* Reads and validates the package metadata in a Chart.yaml document.
|
|
9
|
+
* @param content Chart.yaml contents.
|
|
10
|
+
* @param filePath Chart.yaml path used in validation errors.
|
|
11
|
+
* @returns The chart name and semantic version.
|
|
12
|
+
*/
|
|
13
|
+
function readChartMetadata(content, filePath) {
|
|
14
|
+
const document = parseChartDocument(content, filePath);
|
|
15
|
+
const name = document.get('name');
|
|
16
|
+
const version = document.get('version');
|
|
17
|
+
if (typeof name !== 'string' || !name.trim()) {
|
|
18
|
+
throw new Error(`Chart ${filePath} must define a non-empty name.`);
|
|
19
|
+
}
|
|
20
|
+
if (typeof version !== 'string' || !(0, semver_1.valid)(version)) {
|
|
21
|
+
throw new Error(`Chart ${filePath} must define a valid semantic version in version.`);
|
|
22
|
+
}
|
|
23
|
+
return { name, version };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Updates only the Chart.yaml version while retaining the document structure.
|
|
27
|
+
* @param content Chart.yaml contents.
|
|
28
|
+
* @param filePath Chart.yaml path used in validation errors.
|
|
29
|
+
* @param newVersion New semantic chart version.
|
|
30
|
+
* @returns Updated Chart.yaml contents.
|
|
31
|
+
*/
|
|
32
|
+
function updateChartVersion(content, filePath, newVersion) {
|
|
33
|
+
const document = parseChartDocument(content, filePath);
|
|
34
|
+
const currentVersion = document.get('version');
|
|
35
|
+
if (typeof currentVersion !== 'string' || !(0, semver_1.valid)(currentVersion)) {
|
|
36
|
+
throw new Error(`Chart ${filePath} must define a valid semantic version in version.`);
|
|
37
|
+
}
|
|
38
|
+
if (!(0, semver_1.valid)(newVersion)) {
|
|
39
|
+
throw new Error(`Release version ${newVersion} is not valid semantic version.`);
|
|
40
|
+
}
|
|
41
|
+
document.set('version', newVersion);
|
|
42
|
+
return document.toString();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parses one Chart.yaml document and reports syntax errors with its path.
|
|
46
|
+
* @param content Chart.yaml contents.
|
|
47
|
+
* @param filePath Chart.yaml path used in validation errors.
|
|
48
|
+
* @returns Parsed YAML document.
|
|
49
|
+
*/
|
|
50
|
+
function parseChartDocument(content, filePath) {
|
|
51
|
+
const document = (0, yaml_1.parseDocument)(content, { prettyErrors: false });
|
|
52
|
+
if (document.errors.length > 0) {
|
|
53
|
+
throw new Error(`Chart ${filePath} contains invalid YAML: ${document.errors[0].message}`);
|
|
54
|
+
}
|
|
55
|
+
return document;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=chart-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-manifest.js","sourceRoot":"","sources":["../../../../../plugins/nx/helm/src/chart-manifest.ts"],"names":[],"mappings":";;AAiBA,8CAkBC;AASD,gDAqBC;AAjED,mCAA+B;AAC/B,+BAAqC;AAUrC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,OAAe,EACf,QAAgB;IAEhB,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,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AAS,QAAQ,2BAA2B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CACzE,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
import type { PackageExecutorSchema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Packages the root chart owned by an Nx project into a versioned archive.
|
|
5
|
+
* @param options Executor options supplied by Nx.
|
|
6
|
+
* @param context Nx's executor context.
|
|
7
|
+
* @returns Whether the Helm package operation completed successfully.
|
|
8
|
+
*/
|
|
9
|
+
declare const runExecutor: PromiseExecutor<PackageExecutorSchema>;
|
|
10
|
+
export default runExecutor;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const chart_manifest_1 = require("../../chart-manifest");
|
|
7
|
+
const project_directory_1 = require("../project-directory");
|
|
8
|
+
const run_helm_1 = require("../run-helm");
|
|
9
|
+
/**
|
|
10
|
+
* Packages the root chart owned by an Nx project into a versioned archive.
|
|
11
|
+
* @param options Executor options supplied by Nx.
|
|
12
|
+
* @param context Nx's executor context.
|
|
13
|
+
* @returns Whether the Helm package operation completed successfully.
|
|
14
|
+
*/
|
|
15
|
+
const runExecutor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const projectDirectory = (0, project_directory_1.getProjectDirectory)(context, 'packaging');
|
|
17
|
+
if (!projectDirectory) {
|
|
18
|
+
return { success: false };
|
|
19
|
+
}
|
|
20
|
+
const outputDirectory = (0, node_path_1.resolve)(context.root, options.outputPath);
|
|
21
|
+
const dryRun = isDryRun(options.dryRun);
|
|
22
|
+
try {
|
|
23
|
+
const chartFilePath = (0, node_path_1.join)(projectDirectory, 'Chart.yaml');
|
|
24
|
+
const metadata = (0, chart_manifest_1.readChartMetadata)((0, node_fs_1.readFileSync)(chartFilePath, 'utf8'), chartFilePath);
|
|
25
|
+
const archivePath = (0, node_path_1.join)(outputDirectory, `${metadata.name}-${metadata.version}.tgz`);
|
|
26
|
+
if (dryRun) {
|
|
27
|
+
console.log(`[nx-helm] Would package chart to ${archivePath}`);
|
|
28
|
+
return { success: true };
|
|
29
|
+
}
|
|
30
|
+
(0, node_fs_1.mkdirSync)(outputDirectory, { recursive: true });
|
|
31
|
+
console.log(`[nx-helm] Packaging chart ${projectDirectory}`);
|
|
32
|
+
if (!(yield (0, run_helm_1.runHelm)(['package', '.', '--destination', outputDirectory], projectDirectory))) {
|
|
33
|
+
return { success: false };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(`[nx-helm] Could not package chart ${projectDirectory}: ${getErrorMessage(error)}`);
|
|
38
|
+
return { success: false };
|
|
39
|
+
}
|
|
40
|
+
return { success: true };
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Checks the Nx dry-run environment and executor option.
|
|
44
|
+
* @param optionDryRun Explicit executor dry-run option.
|
|
45
|
+
* @returns Whether the operation must avoid filesystem changes.
|
|
46
|
+
*/
|
|
47
|
+
function isDryRun(optionDryRun) {
|
|
48
|
+
return optionDryRun === true || process.env.NX_DRY_RUN === 'true';
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Converts unknown caught values into useful command-line text.
|
|
52
|
+
* @param error Caught value.
|
|
53
|
+
* @returns Human-readable error text.
|
|
54
|
+
*/
|
|
55
|
+
function getErrorMessage(error) {
|
|
56
|
+
return error instanceof Error ? error.message : String(error);
|
|
57
|
+
}
|
|
58
|
+
exports.default = runExecutor;
|
|
59
|
+
//# sourceMappingURL=package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package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ACb,CAAC,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,eAAe,CAAC,EAClD,gBAAgB,CACjB,CAAC,EACF,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,qCAAqC,gBAAgB,KAAK,eAAe,CAAC,KAAK,CAAC,EAAE,CACnF,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAA,CAAC;AAEF;;;;GAIG;AACH,SAAS,QAAQ,CAAC,YAAiC;IACjD,OAAO,YAAY,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Options accepted by the Helm package executor. */
|
|
2
|
+
export interface PackageExecutorSchema {
|
|
3
|
+
/** Workspace-relative directory where the chart archive is written. */
|
|
4
|
+
outputPath: string;
|
|
5
|
+
/** Whether to report the package operation without writing an archive. */
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Package executor",
|
|
5
|
+
"description": "Package the root Helm chart into a versioned archive.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"outputPath": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Workspace-relative directory where the chart archive is written."
|
|
11
|
+
},
|
|
12
|
+
"dryRun": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Report the package operation without writing an archive."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["outputPath"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the owning Nx project directory for a Helm executor.
|
|
4
|
+
* @param context Nx's executor context.
|
|
5
|
+
* @param operation Operation requiring the project directory.
|
|
6
|
+
* @returns The absolute project directory, or undefined when unavailable.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getProjectDirectory(context: ExecutorContext, operation: string): string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectDirectory = getProjectDirectory;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the owning Nx project directory for a Helm executor.
|
|
7
|
+
* @param context Nx's executor context.
|
|
8
|
+
* @param operation Operation requiring the project directory.
|
|
9
|
+
* @returns The absolute project directory, or undefined when unavailable.
|
|
10
|
+
*/
|
|
11
|
+
function getProjectDirectory(context, operation) {
|
|
12
|
+
const projectName = context.projectName;
|
|
13
|
+
if (!projectName) {
|
|
14
|
+
console.error(`[nx-helm] Helm ${operation} requires an Nx project context.`);
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const project = context.projectsConfigurations.projects[projectName];
|
|
18
|
+
if (!project) {
|
|
19
|
+
console.error(`[nx-helm] Could not resolve Nx project "${projectName}".`);
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return (0, node_path_1.resolve)(context.root, project.root);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=project-directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-directory.js","sourceRoot":"","sources":["../../../../../../plugins/nx/helm/src/executors/project-directory.ts"],"names":[],"mappings":";;AASA,kDAmBC;AA3BD,yCAAoC;AAEpC;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,OAAwB,EACxB,SAAiB;IAEjB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CACX,kBAAkB,SAAS,kCAAkC,CAC9D,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,2CAA2C,WAAW,IAAI,CAAC,CAAC;QAC1E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAA,mBAAO,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromiseExecutor } from '@nx/devkit';
|
|
2
|
+
import type { ReleasePublishExecutorSchema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Pushes the root chart archive during `nx release publish`.
|
|
5
|
+
* @param options Executor options supplied by Nx.
|
|
6
|
+
* @param context Nx's executor context.
|
|
7
|
+
* @returns Whether the Helm chart was published successfully.
|
|
8
|
+
*/
|
|
9
|
+
declare const runExecutor: PromiseExecutor<ReleasePublishExecutorSchema>;
|
|
10
|
+
export default runExecutor;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const chart_manifest_1 = require("../../chart-manifest");
|
|
7
|
+
const project_directory_1 = require("../project-directory");
|
|
8
|
+
const run_helm_1 = require("../run-helm");
|
|
9
|
+
/**
|
|
10
|
+
* Pushes the root chart archive during `nx release publish`.
|
|
11
|
+
* @param options Executor options supplied by Nx.
|
|
12
|
+
* @param context Nx's executor context.
|
|
13
|
+
* @returns Whether the Helm chart was published successfully.
|
|
14
|
+
*/
|
|
15
|
+
const runExecutor = (options, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const projectDirectory = (0, project_directory_1.getProjectDirectory)(context, 'publishing');
|
|
17
|
+
if (!projectDirectory) {
|
|
18
|
+
return { success: false };
|
|
19
|
+
}
|
|
20
|
+
const registry = normalizeRegistry(options.registry);
|
|
21
|
+
if (!registry) {
|
|
22
|
+
console.error('[nx-helm] Helm release publishing requires an OCI registry such as ' +
|
|
23
|
+
'oci://registry.example.com/charts.');
|
|
24
|
+
return { success: false };
|
|
25
|
+
}
|
|
26
|
+
const outputDirectory = (0, node_path_1.resolve)(context.root, options.outputPath);
|
|
27
|
+
const dryRun = isDryRun(options.dryRun);
|
|
28
|
+
if (!(yield publishChart(projectDirectory, outputDirectory, registry, dryRun))) {
|
|
29
|
+
return { success: false };
|
|
30
|
+
}
|
|
31
|
+
return { success: true };
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Normalizes and validates the Helm OCI repository reference.
|
|
35
|
+
* @param registry Configured registry repository.
|
|
36
|
+
* @returns A normalized OCI repository, or undefined when invalid.
|
|
37
|
+
*/
|
|
38
|
+
function normalizeRegistry(registry) {
|
|
39
|
+
let normalized = registry === null || registry === void 0 ? void 0 : registry.trim();
|
|
40
|
+
if (!normalized) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
while (normalized.endsWith('/')) {
|
|
44
|
+
normalized = normalized.slice(0, -1);
|
|
45
|
+
}
|
|
46
|
+
return normalized.startsWith('oci://') ? normalized : undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Packages an absent archive and pushes one chart archive.
|
|
50
|
+
* @param projectDirectory Owning Nx project directory.
|
|
51
|
+
* @param outputDirectory Workspace package output directory.
|
|
52
|
+
* @param registry OCI repository to receive the chart.
|
|
53
|
+
* @param dryRun Whether to avoid package and push operations.
|
|
54
|
+
* @returns Whether the chart publish operation succeeded.
|
|
55
|
+
*/
|
|
56
|
+
function publishChart(projectDirectory, outputDirectory, registry, dryRun) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
const chartFilePath = (0, node_path_1.join)(projectDirectory, 'Chart.yaml');
|
|
60
|
+
const metadata = (0, chart_manifest_1.readChartMetadata)((0, node_fs_1.readFileSync)(chartFilePath, 'utf8'), chartFilePath);
|
|
61
|
+
const archivePath = (0, node_path_1.join)(outputDirectory, `${metadata.name}-${metadata.version}.tgz`);
|
|
62
|
+
if (dryRun) {
|
|
63
|
+
if (!(0, node_fs_1.existsSync)(archivePath)) {
|
|
64
|
+
console.log(`[nx-helm] Would package chart to ${archivePath}`);
|
|
65
|
+
}
|
|
66
|
+
console.log(`[nx-helm] Would push ${archivePath} to ${registry}`);
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (!(0, node_fs_1.existsSync)(archivePath)) {
|
|
70
|
+
(0, node_fs_1.mkdirSync)(outputDirectory, { recursive: true });
|
|
71
|
+
console.log(`[nx-helm] Packaging chart ${projectDirectory}`);
|
|
72
|
+
if (!(yield (0, run_helm_1.runHelm)(['package', '.', '--destination', outputDirectory], projectDirectory))) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!(0, node_fs_1.existsSync)(archivePath)) {
|
|
77
|
+
console.error(`[nx-helm] Helm did not create ${archivePath}.`);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
console.log(`[nx-helm] Publishing chart ${metadata.name}:${metadata.version}`);
|
|
81
|
+
return (0, run_helm_1.runHelm)(['push', archivePath, registry], projectDirectory);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error(`[nx-helm] Could not publish chart ${projectDirectory}: ${getErrorMessage(error)}`);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Checks the Nx dry-run environment and executor option.
|
|
91
|
+
* @param optionDryRun Explicit executor dry-run option.
|
|
92
|
+
* @returns Whether the operation must avoid publishing.
|
|
93
|
+
*/
|
|
94
|
+
function isDryRun(optionDryRun) {
|
|
95
|
+
return optionDryRun === true || process.env.NX_DRY_RUN === 'true';
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Converts unknown caught values into useful command-line text.
|
|
99
|
+
* @param error Caught value.
|
|
100
|
+
* @returns Human-readable error text.
|
|
101
|
+
*/
|
|
102
|
+
function getErrorMessage(error) {
|
|
103
|
+
return error instanceof Error ? error.message : String(error);
|
|
104
|
+
}
|
|
105
|
+
exports.default = runExecutor;
|
|
106
|
+
//# sourceMappingURL=release-publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-publish.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/helm/src/executors/release-publish/release-publish.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAC9D,yCAA0C;AAI1C,yDAAyD;AACzD,4DAA2D;AAC3D,0CAAsC;AAGtC;;;;;GAKG;AACH,MAAM,WAAW,GAAkD,CACjE,OAAO,EACP,OAAO,EACP,EAAE;IACF,MAAM,gBAAgB,GAAG,IAAA,uCAAmB,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACpE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAA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Q,CAAC,EAAE,gBAAgB,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,qCAAqC,gBAAgB,KAAK,eAAe,CAAC,KAAK,CAAC,EAAE,CACnF,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAAA;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,YAAiC;IACjD,OAAO,YAAY,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Options accepted by the Helm Nx Release publish executor. */
|
|
2
|
+
export interface ReleasePublishExecutorSchema {
|
|
3
|
+
/** Workspace-relative directory containing the packaged chart archive. */
|
|
4
|
+
outputPath: string;
|
|
5
|
+
/** OCI registry repository without chart name or version tag. */
|
|
6
|
+
registry?: string;
|
|
7
|
+
/** Whether to report the publish operation without pushing an archive. */
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "Release publish executor",
|
|
5
|
+
"description": "Push the packaged root Helm chart to an OCI registry during nx release publish.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"outputPath": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Workspace-relative directory containing the packaged chart archive."
|
|
11
|
+
},
|
|
12
|
+
"registry": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "OCI registry repository without chart name or version tag."
|
|
15
|
+
},
|
|
16
|
+
"dryRun": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Report the publish operation without pushing an archive."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["outputPath"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs one Helm command without invoking a shell.
|
|
3
|
+
* @param arguments_ Helm command arguments.
|
|
4
|
+
* @param cwd Working directory for the Helm process.
|
|
5
|
+
* @returns Whether Helm exited successfully.
|
|
6
|
+
*/
|
|
7
|
+
export declare function runHelm(arguments_: string[], cwd: string): Promise<boolean>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runHelm = runHelm;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
/**
|
|
6
|
+
* Runs one Helm command without invoking a shell.
|
|
7
|
+
* @param arguments_ Helm command arguments.
|
|
8
|
+
* @param cwd Working directory for the Helm process.
|
|
9
|
+
* @returns Whether Helm exited successfully.
|
|
10
|
+
*/
|
|
11
|
+
function runHelm(arguments_, cwd) {
|
|
12
|
+
return new Promise((resolveCommand) => {
|
|
13
|
+
// Helm is an external CLI intentionally resolved from the user's PATH.
|
|
14
|
+
// eslint-disable-next-line sonarjs/no-os-command-from-path
|
|
15
|
+
const child = (0, node_child_process_1.spawn)('helm', arguments_, {
|
|
16
|
+
cwd,
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
});
|
|
19
|
+
let settled = false;
|
|
20
|
+
const settle = (success) => {
|
|
21
|
+
if (!settled) {
|
|
22
|
+
settled = true;
|
|
23
|
+
resolveCommand(success);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
child.once('error', (error) => {
|
|
27
|
+
console.error(`[nx-helm] Could not run Helm: ${error.message}`);
|
|
28
|
+
settle(false);
|
|
29
|
+
});
|
|
30
|
+
child.once('close', (code) => settle(code === 0));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=run-helm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-helm.js","sourceRoot":"","sources":["../../../../../../plugins/nx/helm/src/executors/run-helm.ts"],"names":[],"mappings":";;AAQA,0BAuBC;AA/BD,2DAA2C;AAE3C;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,UAAoB,EAAE,GAAW;IACvD,OAAO,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;QACpC,uEAAuE;QACvE,2DAA2D;QAC3D,MAAM,KAAK,GAAG,IAAA,0BAAK,EAAC,MAAM,EAAE,UAAU,EAAE;YACtC,GAAG;YACH,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,MAAM,MAAM,GAAG,CAAC,OAAgB,EAAE,EAAE;YAClC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,GAAG,IAAI,CAAC;gBACf,cAAc,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,OAAO,CAAC,KAAK,CAAC,iCAAiC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAChE,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC"}
|