@otwld/nx-argo 0.0.14-staging.1 → 0.0.14

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 (81) hide show
  1. package/executors.json +4 -34
  2. package/generators.json +4 -14
  3. package/package.json +9 -8
  4. package/src/executors/validate.d.ts +3 -0
  5. package/src/executors/validate.js +131 -0
  6. package/src/executors/validate.js.map +1 -0
  7. package/src/executors/validate.schema.json +6 -0
  8. package/src/generators/register.d.ts +9 -0
  9. package/src/generators/register.js +162 -0
  10. package/src/generators/register.js.map +1 -0
  11. package/src/generators/register.schema.json +16 -0
  12. package/src/index.d.ts +4 -21
  13. package/src/index.js +4 -25
  14. package/src/index.js.map +1 -1
  15. package/src/names.d.ts +11 -0
  16. package/src/names.js +88 -0
  17. package/src/names.js.map +1 -0
  18. package/src/plugin.d.ts +2 -0
  19. package/src/plugin.js +27 -0
  20. package/src/plugin.js.map +1 -0
  21. package/CHANGELOG.md +0 -68
  22. package/README.md +0 -38
  23. package/src/executors/copy-image-lock/copy-image-lock.d.ts +0 -5
  24. package/src/executors/copy-image-lock/copy-image-lock.js +0 -15
  25. package/src/executors/copy-image-lock/copy-image-lock.js.map +0 -1
  26. package/src/executors/copy-image-lock/schema.d.ts +0 -19
  27. package/src/executors/copy-image-lock/schema.json +0 -48
  28. package/src/executors/copy-source-revision/copy-source-revision.d.ts +0 -5
  29. package/src/executors/copy-source-revision/copy-source-revision.js +0 -30
  30. package/src/executors/copy-source-revision/copy-source-revision.js.map +0 -1
  31. package/src/executors/copy-source-revision/schema.d.ts +0 -19
  32. package/src/executors/copy-source-revision/schema.json +0 -41
  33. package/src/executors/image-lock.d.ts +0 -16
  34. package/src/executors/image-lock.js +0 -54
  35. package/src/executors/image-lock.js.map +0 -1
  36. package/src/executors/set-source-revision/schema.d.ts +0 -15
  37. package/src/executors/set-source-revision/schema.json +0 -28
  38. package/src/executors/set-source-revision/set-source-revision.d.ts +0 -5
  39. package/src/executors/set-source-revision/set-source-revision.js +0 -21
  40. package/src/executors/set-source-revision/set-source-revision.js.map +0 -1
  41. package/src/executors/shared.d.ts +0 -28
  42. package/src/executors/shared.js +0 -113
  43. package/src/executors/shared.js.map +0 -1
  44. package/src/executors/source-revision.d.ts +0 -9
  45. package/src/executors/source-revision.js +0 -31
  46. package/src/executors/source-revision.js.map +0 -1
  47. package/src/executors/validate-application/schema.d.ts +0 -7
  48. package/src/executors/validate-application/schema.json +0 -19
  49. package/src/executors/validate-application/validate-application.d.ts +0 -5
  50. package/src/executors/validate-application/validate-application.js +0 -39
  51. package/src/executors/validate-application/validate-application.js.map +0 -1
  52. package/src/executors/validate-application-set/schema.d.ts +0 -7
  53. package/src/executors/validate-application-set/schema.json +0 -20
  54. package/src/executors/validate-application-set/validate-application-set.d.ts +0 -5
  55. package/src/executors/validate-application-set/validate-application-set.js +0 -158
  56. package/src/executors/validate-application-set/validate-application-set.js.map +0 -1
  57. package/src/executors/validate-image-lock/schema.d.ts +0 -15
  58. package/src/executors/validate-image-lock/schema.json +0 -36
  59. package/src/executors/validate-image-lock/validate-image-lock.d.ts +0 -5
  60. package/src/executors/validate-image-lock/validate-image-lock.js +0 -12
  61. package/src/executors/validate-image-lock/validate-image-lock.js.map +0 -1
  62. package/src/executors/write-image-lock/schema.d.ts +0 -21
  63. package/src/executors/write-image-lock/schema.json +0 -61
  64. package/src/executors/write-image-lock/write-image-lock.d.ts +0 -5
  65. package/src/executors/write-image-lock/write-image-lock.js +0 -56
  66. package/src/executors/write-image-lock/write-image-lock.js.map +0 -1
  67. package/src/generators/environment-project/environment-project.d.ts +0 -4
  68. package/src/generators/environment-project/environment-project.js +0 -98
  69. package/src/generators/environment-project/environment-project.js.map +0 -1
  70. package/src/generators/environment-project/schema.d.ts +0 -21
  71. package/src/generators/environment-project/schema.json +0 -55
  72. package/src/generators/preview-project/preview-project.d.ts +0 -4
  73. package/src/generators/preview-project/preview-project.js +0 -49
  74. package/src/generators/preview-project/preview-project.js.map +0 -1
  75. package/src/generators/preview-project/schema.d.ts +0 -15
  76. package/src/generators/preview-project/schema.json +0 -42
  77. package/src/generators/stack-project/schema.d.ts +0 -51
  78. package/src/generators/stack-project/schema.json +0 -113
  79. package/src/generators/stack-project/stack-project.d.ts +0 -4
  80. package/src/generators/stack-project/stack-project.js +0 -516
  81. package/src/generators/stack-project/stack-project.js.map +0 -1
package/src/names.js ADDED
@@ -0,0 +1,88 @@
1
+ import { basename, resolve } from 'node:path';
2
+ const label = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/;
3
+ const hostname = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
4
+ export function assertLabel(value, field) {
5
+ if (!label.test(value) || value.length > 63)
6
+ throw new Error(`[nx-argo] ${field} must be a lower-case DNS label of at most 63 characters.`);
7
+ }
8
+ export function assertEnvironment(value) {
9
+ if (value !== 'staging' && value !== 'production')
10
+ throw new Error('[nx-argo] environment must be staging or production.');
11
+ }
12
+ export function namespaceFor(repository, deployable, environment) {
13
+ assertLabel(repository, 'repository');
14
+ assertLabel(deployable, 'deployable');
15
+ assertEnvironment(environment);
16
+ const namespace = `${repository}-${deployable}-${environment}`;
17
+ assertLabel(namespace, 'derived namespace');
18
+ return namespace;
19
+ }
20
+ export function hostnameFor(repository, deployable, service, environment) {
21
+ assertLabel(repository, 'repository');
22
+ assertLabel(deployable, 'deployable');
23
+ assertLabel(service, 'service');
24
+ assertEnvironment(environment);
25
+ const value = `${repository}-${deployable}-${service}.${environment}.otwld.com`;
26
+ assertHostname(value, 'derived hostname');
27
+ return value;
28
+ }
29
+ export function assertHostname(value, field) {
30
+ if (!hostname.test(value))
31
+ throw new Error(`[nx-argo] ${field} must be a lower-case DNS hostname of at most 253 characters.`);
32
+ }
33
+ export function validateIngressValues(value, repository, deployable, environment, owner = deployable) {
34
+ if (validateIngressTree(value, repository, deployable, environment, owner) === 0) {
35
+ throw new Error('[nx-argo] values must contain at least one ingress.hosts block.');
36
+ }
37
+ }
38
+ function validateIngressTree(value, repository, deployable, environment, owner) {
39
+ if (!isRecord(value))
40
+ return 0;
41
+ let ingressCount = 0;
42
+ for (const [key, child] of Object.entries(value)) {
43
+ if (key === 'ingress' && isRecord(child)) {
44
+ validateIngressBlock(child, repository, deployable, environment, owner);
45
+ ingressCount += 1;
46
+ continue;
47
+ }
48
+ if (isRecord(child)) {
49
+ ingressCount += validateIngressTree(child, repository, deployable, environment, key);
50
+ }
51
+ }
52
+ return ingressCount;
53
+ }
54
+ function validateIngressBlock(ingress, repository, deployable, environment, owner) {
55
+ assertLabel(owner, 'ingress service');
56
+ if (!Array.isArray(ingress['hosts']))
57
+ throw new Error('[nx-argo] ingress.hosts must be an array.');
58
+ const expected = hostnameFor(repository, deployable, owner, environment);
59
+ const includesDefault = ingress['hosts'].some((host) => {
60
+ const name = ingressHostName(host);
61
+ assertHostname(name, 'ingress host');
62
+ return name === expected;
63
+ });
64
+ if (!includesDefault)
65
+ throw new Error(`[nx-argo] ingress.hosts for ${owner} must include default host ${expected}.`);
66
+ }
67
+ function ingressHostName(host) {
68
+ if (typeof host === 'string')
69
+ return host;
70
+ if (isRecord(host) && typeof host['host'] === 'string')
71
+ return host['host'];
72
+ throw new Error('[nx-argo] ingress.hosts entries require a host string.');
73
+ }
74
+ export function isRecord(value) {
75
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
76
+ }
77
+ /** Resolves the consumer repository identity from its workspace directory. */
78
+ export function repositoryFromWorkspaceRoot(workspaceRoot) {
79
+ const repository = basename(resolve(workspaceRoot));
80
+ assertLabel(repository, 'repository');
81
+ return repository;
82
+ }
83
+ /** Returns the one GitHub location supported by the V1 platform contract. */
84
+ export function githubUrlFor(repository) {
85
+ assertLabel(repository, 'repository');
86
+ return `https://github.com/otwld/${repository}.git`;
87
+ }
88
+ //# sourceMappingURL=names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../../plugins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AA2B,CAAC,aAAqB;IAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IACpD,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACtC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAAC,UAAkB;IAC7C,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACtC,OAAO,4BAA4B,UAAU,MAAM,CAAC;AACtD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type CreateNodes } from '@nx/devkit';
2
+ export declare const createNodes: CreateNodes;
package/src/plugin.js ADDED
@@ -0,0 +1,27 @@
1
+ import { createNodesFromFiles, } from '@nx/devkit';
2
+ import { dirname, join, relative } from 'node:path';
3
+ export const createNodes = [
4
+ '.argocd/deployables/*/project.json',
5
+ async (files, options, context) => createNodesFromFiles((file, _options, callbackContext) => createDeployableNodes(file, callbackContext), files, options, context),
6
+ ];
7
+ function createDeployableNodes(file, context) {
8
+ const root = relative(context.workspaceRoot, dirname(join(context.workspaceRoot, file))).replaceAll('\\', '/');
9
+ if (!root || root.startsWith('..'))
10
+ return {};
11
+ return {
12
+ projects: {
13
+ [root]: {
14
+ root,
15
+ targets: {
16
+ 'argo:validate': {
17
+ executor: '@otwld/nx-argo:validate',
18
+ cache: true,
19
+ inputs: ['{projectRoot}/**/*'],
20
+ },
21
+ },
22
+ metadata: { targetGroups: { Argo: ['argo:validate'] } },
23
+ },
24
+ },
25
+ };
26
+ }
27
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../../plugins/nx/argo/src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAGrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,oCAAoC;IACpC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAChC,oBAAoB,CAClB,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,CAClC,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,EAC9C,KAAK,EACL,OAAO,EACP,OAAO,CACR;CACJ,CAAC;AACF,SAAS,qBAAqB,CAAC,IAAY,EAAE,OAA2B;IACtE,MAAM,IAAI,GAAG,QAAQ,CACnB,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAC3C,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9C,OAAO;QACL,QAAQ,EAAE;YACR,CAAC,IAAI,CAAC,EAAE;gBACN,IAAI;gBACJ,OAAO,EAAE;oBACP,eAAe,EAAE;wBACf,QAAQ,EAAE,yBAAyB;wBACnC,KAAK,EAAE,IAAI;wBACX,MAAM,EAAE,CAAC,oBAAoB,CAAC;qBAC/B;iBACF;gBACD,QAAQ,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,EAAE,EAAE;aACxD;SACF;KACF,CAAC;AACJ,CAAC"}
package/CHANGELOG.md DELETED
@@ -1,68 +0,0 @@
1
- ## Unreleased
2
-
3
- ### Features
4
-
5
- - Make stable staging Applications descriptor-driven for generated stack projects.
6
- - Generate managed staging and pull-request ApplicationSets from a per-stack
7
- delivery descriptor.
8
-
9
- ### Breaking changes
10
-
11
- - Generate and validate `values-preview.yaml` as the only pull-request preview
12
- values path.
13
- - Stop generating `application-staging.yaml`; stable staging Applications are
14
- generated from repository delivery descriptors.
15
- - Replace the old `validate-application-staging` Application target with the
16
- staging ApplicationSet policy target.
17
- - Remove production values and Applications plus stack promotion and snapshot
18
- targets from the stack-project contract.
19
-
20
- ## 0.0.8 (2026-08-12)
21
-
22
- ### Breaking changes
23
-
24
- - Replace overloaded `validate` and `write-artifact-lock` with composable Application, ApplicationSet, image-lock, and source-revision executors.
25
- - Make GitHub PR-preview rules an explicit `github-pr-preview` ApplicationSet policy instead of a default validation requirement.
26
- - Replace `app` and `apps` generator options with optional generic `dependencies`; environment image locks and application files are opt-in.
27
- - Rename environment boundaries around a generic required `name`, retaining required `service` metadata.
28
-
29
- ## 0.0.6 (2026-08-12)
30
-
31
- ### Breaking changes
32
-
33
- - Replace `application`, `service-application`, and `preview-stack` with `environment-project` and `preview-project`.
34
- - Validate project-local environment locks and preview ApplicationSets; artifact writes are revision-idempotent.
35
-
36
- ## 0.0.5 (2026-08-12)
37
-
38
- ### 🚀 Features
39
-
40
- - **argo:** add GitOps project tooling ([b291a720](https://github.com/otwld/devops/commit/b291a720))
41
-
42
- ### ❤️ Thank You
43
-
44
- - Tréhout Nathan
45
-
46
- ## 0.0.4 (2026-08-12)
47
-
48
- ### 🚀 Features
49
-
50
- - **plugins:** add nx helm and argo plugins ([eb30b828](https://github.com/otwld/devops/commit/eb30b828))
51
-
52
- ### ❤️ Thank You
53
-
54
- - Tréhout Nathan
55
-
56
- ## 0.0.3 (2026-08-12)
57
-
58
- ### 🚀 Features
59
-
60
- - **argo:** add application generator ([a289b72](https://github.com/otwld/monorepo-starter/commit/a289b72))
61
-
62
- ### ❤️ Thank You
63
-
64
- - Tréhout Nathan
65
-
66
- ## 0.0.2 (2026-08-12)
67
-
68
- Initial release.
package/README.md DELETED
@@ -1,38 +0,0 @@
1
- # @otwld/nx-argo
2
-
3
- Nx generators and validation targets for generic Argo CD project boundaries. The
4
- plugin does not create or operate Argo CD resources at runtime.
5
-
6
- Generators:
7
-
8
- - `environment-project`: environment values and optional image-lock validation.
9
- - `preview-project`: preview values and optional pull-request policy.
10
- - `stack-project`: chart/application mapping, managed staging and preview
11
- ApplicationSets, and explicit `delivery:stack-stage`/`delivery:stack-preview`
12
- targets.
13
-
14
- ```bash
15
- pnpm exec nx g @otwld/nx-argo:stack-project catalog \
16
- --chartPath=charts/catalog --chartProject=helm-catalog
17
- ```
18
-
19
- Stack metadata is authoritative: chart path, staging/preview values paths,
20
- repository identity, and application mappings are explicit. Mappings point to
21
- existing Nx OCI image projects. Generators do not assume application names.
22
- `stack-project` manages `delivery.yaml`, `application-staging-set.yaml`,
23
- `application-set.yaml`, and the two environment value files. The generated Argo
24
- sources use the `staging` and `preview/pr-N` branches; production Applications,
25
- production values, promotion targets, and snapshot targets are not generated.
26
- The base descriptor records the stack application, chart path, staging values
27
- path, staging namespace, and mapped Nx image projects; CI may add staging
28
- revision metadata later.
29
-
30
- Validation targets cover Applications, ApplicationSets, image locks, and source
31
- revision mappings. Project-relative file options reject absolute paths and `..`
32
- traversal.
33
-
34
- ```bash
35
- pnpm exec nx build nx-argo
36
- pnpm exec nx lint nx-argo
37
- pnpm exec nx test nx-argo
38
- ```
@@ -1,5 +0,0 @@
1
- import type { PromiseExecutor } from '@nx/devkit';
2
- import type { CopyImageLockExecutorSchema } from './schema';
3
- /** Copies a completed image lock between explicitly named Nx project files. */
4
- declare const runExecutor: PromiseExecutor<CopyImageLockExecutorSchema>;
5
- export default runExecutor;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const image_lock_1 = require("../image-lock");
4
- const shared_1 = require("../shared");
5
- /** Copies a completed image lock between explicitly named Nx project files. */
6
- const runExecutor = async (options, context) => {
7
- const sourcePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context, options.sourceProject), options.sourceFile, 'Source image lock file');
8
- const destinationPath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context, options.destinationProject), options.destinationFile, 'Destination image lock file');
9
- const source = (0, shared_1.readYamlMapping)(sourcePath, 'source image lock');
10
- (0, image_lock_1.validateImageLock)(source, (0, image_lock_1.getImageLockPaths)(options), sourcePath, false);
11
- (0, shared_1.writeYamlMapping)(destinationPath, source);
12
- return { success: true };
13
- };
14
- exports.default = runExecutor;
15
- //# sourceMappingURL=copy-image-lock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-image-lock.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/copy-image-lock/copy-image-lock.ts"],"names":[],"mappings":";;AAEA,8CAAqE;AACrE,sCAKmB;AAInB,+EAA+E;AAC/E,MAAM,WAAW,GAAiD,KAAK,EACrE,OAAO,EACP,OAAO,EACP,EAAE;IACF,MAAM,UAAU,GAAG,IAAA,2BAAkB,EACnC,IAAA,uBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,EAC9C,OAAO,CAAC,UAAU,EAClB,wBAAwB,CACzB,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,2BAAkB,EACxC,IAAA,uBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACnD,OAAO,CAAC,eAAe,EACvB,6BAA6B,CAC9B,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,wBAAe,EAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAChE,IAAA,8BAAiB,EAAC,MAAM,EAAE,IAAA,8BAAiB,EAAC,OAAO,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACzE,IAAA,yBAAgB,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1,19 +0,0 @@
1
- /** Options accepted by the image-lock copier. */
2
- export interface CopyImageLockExecutorSchema {
3
- /** Nx project containing the source lock. */
4
- sourceProject: string;
5
- /** Source lock file relative to sourceProject. */
6
- sourceFile: string;
7
- /** Nx project containing the destination lock. */
8
- destinationProject: string;
9
- /** Destination lock file relative to destinationProject. */
10
- destinationFile: string;
11
- /** Optional repository YAML path. */
12
- repositoryPath?: string;
13
- /** Optional digest YAML path. */
14
- digestPath?: string;
15
- /** Optional service YAML path. */
16
- servicePath?: string;
17
- /** Optional source revision YAML path. */
18
- sourceRevisionPath?: string;
19
- }
@@ -1,48 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "version": 2,
4
- "title": "Copy image lock",
5
- "description": "Copy a completed image lock between explicitly named Nx project files.",
6
- "type": "object",
7
- "properties": {
8
- "sourceProject": {
9
- "type": "string",
10
- "description": "Nx project containing the source lock."
11
- },
12
- "sourceFile": {
13
- "type": "string",
14
- "description": "Source lock file relative to sourceProject."
15
- },
16
- "destinationProject": {
17
- "type": "string",
18
- "description": "Nx project containing the destination lock."
19
- },
20
- "destinationFile": {
21
- "type": "string",
22
- "description": "Destination lock file relative to destinationProject."
23
- },
24
- "repositoryPath": {
25
- "type": "string",
26
- "description": "Optional repository YAML path."
27
- },
28
- "digestPath": {
29
- "type": "string",
30
- "description": "Optional digest YAML path."
31
- },
32
- "servicePath": {
33
- "type": "string",
34
- "description": "Optional service YAML path."
35
- },
36
- "sourceRevisionPath": {
37
- "type": "string",
38
- "description": "Optional source revision YAML path."
39
- }
40
- },
41
- "required": [
42
- "sourceProject",
43
- "sourceFile",
44
- "destinationProject",
45
- "destinationFile"
46
- ],
47
- "additionalProperties": false
48
- }
@@ -1,5 +0,0 @@
1
- import type { PromiseExecutor } from '@nx/devkit';
2
- import type { CopySourceRevisionExecutorSchema } from './schema';
3
- /** Copies a selected Application source revision between two project-local files. */
4
- declare const runExecutor: PromiseExecutor<CopySourceRevisionExecutorSchema>;
5
- export default runExecutor;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const shared_1 = require("../shared");
4
- const source_revision_1 = require("../source-revision");
5
- /** Copies a selected Application source revision between two project-local files. */
6
- const runExecutor = async (options, context) => {
7
- const sourcePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context, options.sourceProject), options.sourceFile, 'Source Application file');
8
- const destinationPath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context, options.destinationProject), options.destinationFile, 'Destination Application file');
9
- const sourceApplication = readApplication(sourcePath, 'source');
10
- const source = (0, source_revision_1.selectSource)(sourceApplication, options);
11
- if (!(0, shared_1.isNonEmptyString)(source['targetRevision'])) {
12
- throw new Error('[nx-argo] The selected source targetRevision must be a nonempty string.');
13
- }
14
- const destinationApplication = readApplication(destinationPath, 'destination');
15
- (0, source_revision_1.selectSource)(destinationApplication, options)['targetRevision'] =
16
- source['targetRevision'];
17
- (0, shared_1.writeYamlMapping)(destinationPath, destinationApplication);
18
- return { success: true };
19
- };
20
- /** Reads an Application document for source revision copying. */
21
- function readApplication(filePath, label) {
22
- const application = (0, shared_1.readYamlMapping)(filePath, `${label} Argo CD Application`);
23
- if (application['apiVersion'] !== 'argoproj.io/v1alpha1' ||
24
- application['kind'] !== 'Application') {
25
- throw new Error(`[nx-argo] Invalid ${label} Argo CD Application: ${filePath}`);
26
- }
27
- return application;
28
- }
29
- exports.default = runExecutor;
30
- //# sourceMappingURL=copy-source-revision.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-source-revision.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/copy-source-revision/copy-source-revision.ts"],"names":[],"mappings":";;AAEA,sCAMmB;AACnB,wDAAkD;AAIlD,qFAAqF;AACrF,MAAM,WAAW,GAAsD,KAAK,EAC1E,OAAO,EACP,OAAO,EACP,EAAE;IACF,MAAM,UAAU,GAAG,IAAA,2BAAkB,EACnC,IAAA,uBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,EAC9C,OAAO,CAAC,UAAU,EAClB,yBAAyB,CAC1B,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,2BAAkB,EACxC,IAAA,uBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACnD,OAAO,CAAC,eAAe,EACvB,8BAA8B,CAC/B,CAAC;IACF,MAAM,iBAAiB,GAAG,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,CAAC,IAAA,yBAAgB,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,MAAM,sBAAsB,GAAG,eAAe,CAC5C,eAAe,EACf,aAAa,CACd,CAAC;IACF,IAAA,8BAAY,EAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,gBAAgB,CAAC;QAC7D,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC3B,IAAA,yBAAgB,EAAC,eAAe,EAAE,sBAAsB,CAAC,CAAC;IAC1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,iEAAiE;AACjE,SAAS,eAAe,CACtB,QAAgB,EAChB,KAAa;IAEb,MAAM,WAAW,GAAG,IAAA,wBAAe,EAAC,QAAQ,EAAE,GAAG,KAAK,sBAAsB,CAAC,CAAC;IAC9E,IACE,WAAW,CAAC,YAAY,CAAC,KAAK,sBAAsB;QACpD,WAAW,CAAC,MAAM,CAAC,KAAK,aAAa,EACrC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,qBAAqB,KAAK,yBAAyB,QAAQ,EAAE,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,kBAAe,WAAW,CAAC"}
@@ -1,19 +0,0 @@
1
- /** Options accepted by the Application source-revision copier. */
2
- export interface CopySourceRevisionExecutorSchema {
3
- /** Nx project containing the source Application. */
4
- sourceProject: string;
5
- /** Source Application file relative to sourceProject. */
6
- sourceFile: string;
7
- /** Nx project containing the destination Application. */
8
- destinationProject: string;
9
- /** Destination Application file relative to destinationProject. */
10
- destinationFile: string;
11
- /** Repository URL of the source to copy. */
12
- repoURL: string;
13
- /** Optional chart selector. */
14
- chart?: string;
15
- /** Optional path selector. */
16
- path?: string;
17
- /** Optional ref selector. */
18
- ref?: string;
19
- }
@@ -1,41 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "version": 2,
4
- "title": "Copy Application source revision",
5
- "description": "Copy targetRevision for an exactly selected Application source.",
6
- "type": "object",
7
- "properties": {
8
- "sourceProject": {
9
- "type": "string",
10
- "description": "Nx project containing the source Application."
11
- },
12
- "sourceFile": {
13
- "type": "string",
14
- "description": "Source Application file relative to sourceProject."
15
- },
16
- "destinationProject": {
17
- "type": "string",
18
- "description": "Nx project containing the destination Application."
19
- },
20
- "destinationFile": {
21
- "type": "string",
22
- "description": "Destination Application file relative to destinationProject."
23
- },
24
- "repoURL": {
25
- "type": "string",
26
- "minLength": 1,
27
- "description": "Repository URL of the source to copy."
28
- },
29
- "chart": { "type": "string", "description": "Optional chart selector." },
30
- "path": { "type": "string", "description": "Optional path selector." },
31
- "ref": { "type": "string", "description": "Optional ref selector." }
32
- },
33
- "required": [
34
- "sourceProject",
35
- "sourceFile",
36
- "destinationProject",
37
- "destinationFile",
38
- "repoURL"
39
- ],
40
- "additionalProperties": false
41
- }
@@ -1,16 +0,0 @@
1
- /** Configurable YAML mappings for the four canonical image-lock values. */
2
- export interface ImageLockPaths {
3
- repository: string[];
4
- digest: string[];
5
- service: string[];
6
- sourceRevision: string[];
7
- }
8
- /** Builds image-lock mappings from explicit options or canonical defaults. */
9
- export declare function getImageLockPaths(options: {
10
- repositoryPath?: string;
11
- digestPath?: string;
12
- servicePath?: string;
13
- sourceRevisionPath?: string;
14
- }): ImageLockPaths;
15
- /** Validates a pending or complete canonical image lock. */
16
- export declare function validateImageLock(lock: Record<string, unknown>, paths: ImageLockPaths, filePath: string, allowPending?: boolean): void;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getImageLockPaths = getImageLockPaths;
4
- exports.validateImageLock = validateImageLock;
5
- const shared_1 = require("./shared");
6
- /** Builds image-lock mappings from explicit options or canonical defaults. */
7
- function getImageLockPaths(options) {
8
- const paths = {
9
- repository: (0, shared_1.parsePath)(options.repositoryPath ?? shared_1.canonicalImageLockPaths.repository),
10
- digest: (0, shared_1.parsePath)(options.digestPath ?? shared_1.canonicalImageLockPaths.digest),
11
- service: (0, shared_1.parsePath)(options.servicePath ?? shared_1.canonicalImageLockPaths.service),
12
- sourceRevision: (0, shared_1.parsePath)(options.sourceRevisionPath ?? shared_1.canonicalImageLockPaths.sourceRevision),
13
- };
14
- assertDistinctPaths(paths);
15
- return paths;
16
- }
17
- /** Validates a pending or complete canonical image lock. */
18
- function validateImageLock(lock, paths, filePath, allowPending = true) {
19
- const pending = (0, shared_1.getPath)(lock, ['artifact', 'pending']);
20
- const values = [
21
- (0, shared_1.getPath)(lock, paths.repository),
22
- (0, shared_1.getPath)(lock, paths.digest),
23
- (0, shared_1.getPath)(lock, paths.service),
24
- (0, shared_1.getPath)(lock, paths.sourceRevision),
25
- ];
26
- if (pending === true) {
27
- if (allowPending && values.every((value) => value === '')) {
28
- return;
29
- }
30
- throw new Error(`[nx-argo] Invalid pending image lock: ${filePath}`);
31
- }
32
- if (pending !== undefined && pending !== false) {
33
- throw new Error(`[nx-argo] Invalid image lock: ${filePath}`);
34
- }
35
- if (!(0, shared_1.isNonEmptyString)(values[0]) ||
36
- !(0, shared_1.isDigest)(values[1]) ||
37
- !(0, shared_1.isNonEmptyString)(values[2]) ||
38
- !(0, shared_1.isNonEmptyString)(values[3])) {
39
- throw new Error(`[nx-argo] Invalid image lock: ${filePath}`);
40
- }
41
- }
42
- /** Rejects equal or overlapping mappings before writes can corrupt a lock. */
43
- function assertDistinctPaths(paths) {
44
- const entries = Object.entries(paths);
45
- for (const [index, [name, path]] of entries.entries()) {
46
- for (const [otherName, otherPath] of entries.slice(index + 1)) {
47
- if (path.every((segment, pathIndex) => otherPath[pathIndex] === segment) ||
48
- otherPath.every((segment, pathIndex) => path[pathIndex] === segment)) {
49
- throw new Error(`[nx-argo] Image-lock mapping paths conflict: ${name} and ${otherName}.`);
50
- }
51
- }
52
- }
53
- }
54
- //# sourceMappingURL=image-lock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-lock.js","sourceRoot":"","sources":["../../../../../../plugins/nx/argo/src/executors/image-lock.ts"],"names":[],"mappings":";;AAiBA,8CAkBC;AAGD,8CA+BC;AArED,qCAMkB;AAUlB,8EAA8E;AAC9E,SAAgB,iBAAiB,CAAC,OAKjC;IACC,MAAM,KAAK,GAAG;QACZ,UAAU,EAAE,IAAA,kBAAS,EACnB,OAAO,CAAC,cAAc,IAAI,gCAAuB,CAAC,UAAU,CAC7D;QACD,MAAM,EAAE,IAAA,kBAAS,EAAC,OAAO,CAAC,UAAU,IAAI,gCAAuB,CAAC,MAAM,CAAC;QACvE,OAAO,EAAE,IAAA,kBAAS,EAAC,OAAO,CAAC,WAAW,IAAI,gCAAuB,CAAC,OAAO,CAAC;QAC1E,cAAc,EAAE,IAAA,kBAAS,EACvB,OAAO,CAAC,kBAAkB,IAAI,gCAAuB,CAAC,cAAc,CACrE;KACF,CAAC;IACF,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4DAA4D;AAC5D,SAAgB,iBAAiB,CAC/B,IAA6B,EAC7B,KAAqB,EACrB,QAAgB,EAChB,YAAY,GAAG,IAAI;IAEnB,MAAM,OAAO,GAAG,IAAA,gBAAO,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG;QACb,IAAA,gBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC;QAC/B,IAAA,gBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAA,gBAAO,EAA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AAC,KAAK,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC;gBACpE,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,EACpE,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,gDAAgD,IAAI,QAAQ,SAAS,GAAG,CACzE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,15 +0,0 @@
1
- /** Options accepted by the Application source-revision writer. */
2
- export interface SetSourceRevisionExecutorSchema {
3
- /** Application manifest relative to the owning Nx project root. */
4
- file: string;
5
- /** Repository URL of the source to update. */
6
- repoURL: string;
7
- /** Optional chart selector. */
8
- chart?: string;
9
- /** Optional path selector. */
10
- path?: string;
11
- /** Optional ref selector. */
12
- ref?: string;
13
- /** Revision to set. */
14
- targetRevision: string;
15
- }
@@ -1,28 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "version": 2,
4
- "title": "Set Application source revision",
5
- "description": "Set targetRevision for exactly one selected Application source.",
6
- "type": "object",
7
- "properties": {
8
- "file": {
9
- "type": "string",
10
- "description": "Application manifest relative to the owning Nx project root."
11
- },
12
- "repoURL": {
13
- "type": "string",
14
- "minLength": 1,
15
- "description": "Repository URL of the source to update."
16
- },
17
- "chart": { "type": "string", "description": "Optional chart selector." },
18
- "path": { "type": "string", "description": "Optional path selector." },
19
- "ref": { "type": "string", "description": "Optional ref selector." },
20
- "targetRevision": {
21
- "type": "string",
22
- "minLength": 1,
23
- "description": "Revision to set."
24
- }
25
- },
26
- "required": ["file", "repoURL", "targetRevision"],
27
- "additionalProperties": false
28
- }
@@ -1,5 +0,0 @@
1
- import type { PromiseExecutor } from '@nx/devkit';
2
- import type { SetSourceRevisionExecutorSchema } from './schema';
3
- /** Sets targetRevision for the Application source identified by stable fields. */
4
- declare const runExecutor: PromiseExecutor<SetSourceRevisionExecutorSchema>;
5
- export default runExecutor;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const shared_1 = require("../shared");
4
- const source_revision_1 = require("../source-revision");
5
- /** Sets targetRevision for the Application source identified by stable fields. */
6
- const runExecutor = async (options, context) => {
7
- if (!options.targetRevision.trim()) {
8
- throw new Error('[nx-argo] targetRevision is required.');
9
- }
10
- const filePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context), options.file, 'Application file');
11
- const application = (0, shared_1.readYamlMapping)(filePath, 'Argo CD Application');
12
- if (application['apiVersion'] !== 'argoproj.io/v1alpha1' ||
13
- application['kind'] !== 'Application') {
14
- throw new Error(`[nx-argo] Invalid Argo CD Application: ${filePath}`);
15
- }
16
- (0, source_revision_1.selectSource)(application, options)['targetRevision'] = options.targetRevision;
17
- (0, shared_1.writeYamlMapping)(filePath, application);
18
- return { success: true };
19
- };
20
- exports.default = runExecutor;
21
- //# sourceMappingURL=set-source-revision.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-source-revision.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/set-source-revision/set-source-revision.ts"],"names":[],"mappings":";;AAEA,sCAKmB;AACnB,wDAAkD;AAIlD,kFAAkF;AAClF,MAAM,WAAW,GAAqD,KAAK,EACzE,OAAO,EACP,OAAO,EACP,EAAE;IACF,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,QAAQ,GAAG,IAAA,2BAAkB,EACjC,IAAA,uBAAc,EAAC,OAAO,CAAC,EACvB,OAAO,CAAC,IAAI,EACZ,kBAAkB,CACnB,CAAC;IACF,MAAM,WAAW,GAAG,IAAA,wBAAe,EAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IACrE,IACE,WAAW,CAAC,YAAY,CAAC,KAAK,sBAAsB;QACpD,WAAW,CAAC,MAAM,CAAC,KAAK,aAAa,EACrC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,0CAA0C,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,IAAA,8BAAY,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAC9E,IAAA,yBAAgB,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1,28 +0,0 @@
1
- import type { ExecutorContext } from '@nx/devkit';
2
- /** Canonical image-lock paths used when a validator or copier omits mappings. */
3
- export declare const canonicalImageLockPaths: {
4
- readonly repository: "image.repository";
5
- readonly digest: "image.digest";
6
- readonly service: "artifact.service";
7
- readonly sourceRevision: "artifact.sourceRevision";
8
- };
9
- /** Resolves a project root from an executor context. */
10
- export declare function getProjectRoot(context: ExecutorContext, project?: string): string;
11
- /** Resolves a required project-local file without permitting path escapes. */
12
- export declare function resolveProjectFile(root: string, file: string | undefined, optionName: string): string;
13
- /** Reads an existing YAML mapping with a domain-specific error label. */
14
- export declare function readYamlMapping(filePath: string, label: string): Record<string, unknown>;
15
- /** Writes a YAML mapping using the package's stable formatting. */
16
- export declare function writeYamlMapping(filePath: string, value: Record<string, unknown>): void;
17
- /** Narrows a YAML value to a simple mapping. */
18
- export declare function isMap(value: unknown): value is Record<string, unknown>;
19
- /** Reads a nested mapping path without coercing malformed values. */
20
- export declare function getPath(root: Record<string, unknown>, path: string[]): unknown;
21
- /** Parses a dot-separated mapping path. */
22
- export declare function parsePath(path: string, label?: string): string[];
23
- /** Sets a mapping path and rejects scalar conflicts on the route. */
24
- export declare function setPath(root: Record<string, unknown>, segments: string[], value: unknown): void;
25
- /** Requires a nonempty string scalar. */
26
- export declare function isNonEmptyString(value: unknown): value is string;
27
- /** Validates an immutable SHA-256 image digest. */
28
- export declare function isDigest(value: unknown): value is string;