@otwld/nx-argo 0.0.14-staging.0 → 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/executors.json CHANGED
@@ -1,40 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/schema",
3
3
  "executors": {
4
- "validate-application": {
5
- "implementation": "./src/executors/validate-application/validate-application",
6
- "schema": "./src/executors/validate-application/schema.json",
7
- "description": "Validate an Argo CD Application manifest."
8
- },
9
- "validate-application-set": {
10
- "implementation": "./src/executors/validate-application-set/validate-application-set",
11
- "schema": "./src/executors/validate-application-set/schema.json",
12
- "description": "Validate an Argo CD ApplicationSet manifest and optional policy."
13
- },
14
- "validate-image-lock": {
15
- "implementation": "./src/executors/validate-image-lock/validate-image-lock",
16
- "schema": "./src/executors/validate-image-lock/schema.json",
17
- "description": "Validate a pending or completed image lock."
18
- },
19
- "write-image-lock": {
20
- "implementation": "./src/executors/write-image-lock/write-image-lock",
21
- "schema": "./src/executors/write-image-lock/schema.json",
22
- "description": "Write or verify an immutable image lock."
23
- },
24
- "copy-image-lock": {
25
- "implementation": "./src/executors/copy-image-lock/copy-image-lock",
26
- "schema": "./src/executors/copy-image-lock/schema.json",
27
- "description": "Copy a completed image lock between Nx projects."
28
- },
29
- "set-source-revision": {
30
- "implementation": "./src/executors/set-source-revision/set-source-revision",
31
- "schema": "./src/executors/set-source-revision/schema.json",
32
- "description": "Set targetRevision for one selected Application source."
33
- },
34
- "copy-source-revision": {
35
- "implementation": "./src/executors/copy-source-revision/copy-source-revision",
36
- "schema": "./src/executors/copy-source-revision/schema.json",
37
- "description": "Copy a selected Application source revision between Nx projects."
4
+ "validate": {
5
+ "implementation": "./src/executors/validate",
6
+ "schema": "./src/executors/validate.schema.json",
7
+ "description": "Validate deployable bundles without external calls."
38
8
  }
39
9
  }
40
10
  }
package/generators.json CHANGED
@@ -1,20 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/schema",
3
3
  "generators": {
4
- "environment-project": {
5
- "factory": "./src/generators/environment-project/environment-project",
6
- "schema": "./src/generators/environment-project/schema.json",
7
- "description": "Create a GitOps project boundary for one service environment."
8
- },
9
- "preview-project": {
10
- "factory": "./src/generators/preview-project/preview-project",
11
- "schema": "./src/generators/preview-project/schema.json",
12
- "description": "Create a GitOps project boundary for an explicit preview stack."
13
- },
14
- "stack-project": {
15
- "factory": "./src/generators/stack-project/stack-project",
16
- "schema": "./src/generators/stack-project/schema.json",
17
- "description": "Create one generic GitOps boundary for a complete Helm stack."
4
+ "register": {
5
+ "factory": "./src/generators/register",
6
+ "schema": "./src/generators/register.schema.json",
7
+ "description": "Create an inactive Argo deployable bundle from an existing chart."
18
8
  }
19
9
  }
20
10
  }
package/package.json CHANGED
@@ -1,28 +1,29 @@
1
1
  {
2
2
  "name": "@otwld/nx-argo",
3
- "version": "0.0.14-staging.0",
3
+ "version": "0.0.14",
4
4
  "private": false,
5
- "type": "commonjs",
5
+ "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "@nx/nx-source": "./src/index.ts",
9
9
  "types": "./src/index.d.ts",
10
+ "import": "./src/index.js",
10
11
  "default": "./src/index.js"
11
12
  },
12
13
  "./package.json": "./package.json",
13
- "./generators.json": "./generators.json",
14
- "./executors.json": "./executors.json"
14
+ "./executors.json": "./executors.json",
15
+ "./generators.json": "./generators.json"
15
16
  },
16
17
  "main": "./src/index.js",
18
+ "module": "./src/index.js",
17
19
  "types": "./src/index.d.ts",
18
20
  "dependencies": {
19
21
  "@nx/devkit": "23.1.1",
20
- "semver": "^7.8.5",
21
- "tslib": "^2.3.0",
22
- "yaml": "^2.9.0"
22
+ "tslib": "^2.8.1",
23
+ "yaml": "2.9.0"
23
24
  },
24
25
  "peerDependencies": {
25
- "nx": ">=22 <=24 || ^23.0.0-0"
26
+ "nx": "23.1.1"
26
27
  },
27
28
  "publishConfig": {
28
29
  "access": "public"
@@ -0,0 +1,3 @@
1
+ import type { PromiseExecutor } from '@nx/devkit';
2
+ declare const executor: PromiseExecutor<Record<string, never>>;
3
+ export default executor;
@@ -0,0 +1,131 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join, resolve } from 'node:path';
3
+ import { parseDocument } from 'yaml';
4
+ import { assertEnvironment, assertLabel, githubUrlFor, isRecord, namespaceFor, repositoryFromWorkspaceRoot, validateIngressValues, } from '../names.js';
5
+ const environments = ['staging', 'production'];
6
+ const executor = async (_options, context) => {
7
+ try {
8
+ const project = context.projectName &&
9
+ context.projectsConfigurations?.projects[context.projectName];
10
+ if (!project)
11
+ throw new Error('[nx-argo] The executor requires a deployable project context.');
12
+ const projectName = context.projectName ?? '';
13
+ if (!projectName.startsWith('deployable-'))
14
+ throw new Error('[nx-argo] The project name must use deployable-<deployable>.');
15
+ const deployable = projectName.slice('deployable-'.length);
16
+ assertLabel(deployable, 'deployable');
17
+ const expectedRoot = `.argocd/deployables/${deployable}`;
18
+ if (project.root.replaceAll('\\', '/').replace(/^\.\//, '') !== expectedRoot)
19
+ throw new Error(`[nx-argo] ${projectName} must be rooted at ${expectedRoot}.`);
20
+ const root = resolve(context.root, project.root);
21
+ const repository = repositoryFromWorkspaceRoot(context.root);
22
+ for (const environment of environments)
23
+ validateBundle(root, repository, deployable, environment);
24
+ return { success: true };
25
+ }
26
+ catch (error) {
27
+ console.error(error instanceof Error ? error.message : error);
28
+ return { success: false };
29
+ }
30
+ };
31
+ function validateBundle(root, repository, deployable, environment) {
32
+ assertEnvironment(environment);
33
+ namespaceFor(repository, deployable, environment);
34
+ const directory = join(root, environment);
35
+ for (const name of ['state.yaml', 'values.yaml'])
36
+ if (!existsSync(join(directory, name)))
37
+ throw new Error(`[nx-argo] Missing ${environment}/${name}.`);
38
+ const state = yaml(join(directory, 'state.yaml'));
39
+ const values = yaml(join(directory, 'values.yaml'));
40
+ if (!isRecord(state) ||
41
+ state['deployable'] !== deployable ||
42
+ typeof state['registered'] !== 'boolean' ||
43
+ typeof state['enabled'] !== 'boolean' ||
44
+ !isRecord(state['chart']) ||
45
+ typeof state['chart']['repository'] !== 'string' ||
46
+ typeof state['chart']['version'] !== 'string')
47
+ throw new Error(`[nx-argo] ${environment}/state.yaml has an invalid required shape.`);
48
+ if (state['enabled'] === true && state['registered'] === false)
49
+ throw new Error(`[nx-argo] ${environment} cannot be enabled while unregistered.`);
50
+ if (state['registered'] === true &&
51
+ (!state['chart']['repository'] || !state['chart']['version']))
52
+ throw new Error(`[nx-argo] Registered ${environment} requires chart repository and version.`);
53
+ validateIngressValues(values, repository, deployable, environment);
54
+ const policyPath = join(directory, 'image-updater.yaml');
55
+ if (existsSync(policyPath))
56
+ validatePolicy(yaml(policyPath), repository, deployable, environment);
57
+ }
58
+ function yaml(file) {
59
+ const document = parseDocument(readFileSync(file, 'utf8'));
60
+ if (document.errors.length)
61
+ throw new Error(`[nx-argo] ${file} is invalid YAML.`);
62
+ return document.toJS();
63
+ }
64
+ function validatePolicy(policy, repository, deployable, environment) {
65
+ if (!isRecord(policy) || !isRecord(policy['spec']))
66
+ throw new Error('[nx-argo] image-updater.yaml requires spec.');
67
+ const application = `${repository}-${deployable}-${environment}`;
68
+ if (policy['apiVersion'] !== 'argocd-image-updater.argoproj.io/v1alpha1' ||
69
+ policy['kind'] !== 'ImageUpdater' ||
70
+ !isRecord(policy['metadata']) ||
71
+ policy['metadata']['name'] !== application ||
72
+ policy['metadata']['namespace'] !== 'argocd')
73
+ throw new Error('[nx-argo] image-updater.yaml requires the v1.3 ImageUpdater identity.');
74
+ const spec = policy['spec'];
75
+ if ('images' in spec)
76
+ throw new Error('[nx-argo] spec.images is not valid for Image Updater v1.3.0.');
77
+ if (!Array.isArray(spec['applicationRefs']) ||
78
+ spec['applicationRefs'].length !== 1 ||
79
+ !isRecord(spec['applicationRefs'][0]))
80
+ throw new Error('[nx-argo] image-updater.yaml requires one spec.applicationRefs entry.');
81
+ const reference = spec['applicationRefs'][0];
82
+ if (reference['namePattern'] !== application ||
83
+ !Array.isArray(reference['images']))
84
+ throw new Error('[nx-argo] applicationRefs requires namePattern and nested images.');
85
+ if (!reference['images'].length)
86
+ throw new Error('[nx-argo] applicationRefs requires at least one nested image.');
87
+ const expectedTags = environment === 'staging'
88
+ ? 'regexp:^.+-staging\\.[0-9]+$'
89
+ : 'regexp:^[0-9]+\\.[0-9]+\\.[0-9]+$';
90
+ const expectedStrategy = environment === 'staging' ? 'newest-build' : 'semver';
91
+ const aliases = new Set();
92
+ reference['images'].forEach((image) => {
93
+ if (!isRecord(image) ||
94
+ typeof image['alias'] !== 'string' ||
95
+ !nonEmptyString(image['imageName']) ||
96
+ !isRecord(image['commonUpdateSettings']) ||
97
+ !isRecord(image['manifestTargets']) ||
98
+ !isRecord(image['manifestTargets']['helm']))
99
+ throw new Error('[nx-argo] Image Updater mappings require nested settings and Helm manifest targets.');
100
+ assertLabel(image['alias'], 'Image Updater image alias');
101
+ if (aliases.has(image['alias']))
102
+ throw new Error(`[nx-argo] Duplicate Image Updater image alias ${image['alias']}.`);
103
+ aliases.add(image['alias']);
104
+ const settings = image['commonUpdateSettings'];
105
+ const helm = image['manifestTargets']['helm'];
106
+ if (settings['updateStrategy'] !== expectedStrategy ||
107
+ settings['allowTags'] !== expectedTags ||
108
+ !nonEmptyString(helm['name']) ||
109
+ !nonEmptyString(helm['tag']))
110
+ throw new Error(`[nx-argo] ${environment} Image Updater mapping does not match the required policy.`);
111
+ });
112
+ if (!isRecord(spec['writeBackConfig']) ||
113
+ spec['writeBackConfig']['method'] !==
114
+ 'git:secret:argocd/argocd-github-otwld-repo-creds' ||
115
+ !isRecord(spec['writeBackConfig']['gitConfig']))
116
+ throw new Error('[nx-argo] writeBackConfig must use the shared Git credential.');
117
+ const git = spec['writeBackConfig']['gitConfig'];
118
+ if (git['repository'] !== githubUrlFor(repository) ||
119
+ git['writeBackTarget'] !==
120
+ `helmvalues:./.argocd/deployables/${deployable}/${environment}/values.yaml` ||
121
+ 'branch' in git ||
122
+ !isRecord(git['pullRequest']) ||
123
+ !isRecord(git['pullRequest']['github']) ||
124
+ 'gitlab' in git['pullRequest'])
125
+ throw new Error('[nx-argo] writeBackConfig requires the consumer GitHub repository, pull-request mode, exact Helm values target, and no branch override.');
126
+ }
127
+ function nonEmptyString(value) {
128
+ return typeof value === 'string' && Boolean(value.trim());
129
+ }
130
+ export default executor;
131
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../plugins/nx/argo/src/executors/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,YAAY,CAAU,CAAC;AACxD,MAAM,QAAQ,GAA2C,KAAK,EAC5D,QAAQ,EACR,OAAO,EACP,EAAE;IACF,IAAI,CAAC;QACH,MAAM,OAAO,GACX,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;QACJ,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAA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WAAW,cAAc;QAC7E,QAAQ,IAAI,GAAG;QACf,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC7B,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC;QACvC,QAAQ,IAAI,GAAG,CAAC,aAAa,CAAC;QAE9B,MAAM,IAAI,KAAK,CACb,yIAAyI,CAC1I,CAAC;AACN,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AACD,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "type": "object",
4
+ "additionalProperties": false,
5
+ "properties": {}
6
+ }
@@ -0,0 +1,9 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export interface RegisterOptions {
3
+ chartProject: string;
4
+ deployable: string;
5
+ chartRepository?: string;
6
+ chartVersion?: string;
7
+ image?: string[];
8
+ }
9
+ export default function registerGenerator(tree: Tree, options: RegisterOptions): Promise<void>;
@@ -0,0 +1,162 @@
1
+ import { addProjectConfiguration, getProjects, joinPathFragments, readProjectConfiguration, } from '@nx/devkit';
2
+ import { parseDocument, stringify } from 'yaml';
3
+ import { assertLabel, githubUrlFor, hostnameFor, namespaceFor, repositoryFromWorkspaceRoot, validateIngressValues, } from '../names.js';
4
+ const environments = ['staging', 'production'];
5
+ export default async function registerGenerator(tree, options) {
6
+ const deployable = requiredLabel(options.deployable, 'deployable');
7
+ const repository = repositoryFromWorkspaceRoot(tree.root);
8
+ const githubUrl = githubUrlFor(repository);
9
+ const chartValues = chartValuesPath(tree, options.chartProject);
10
+ const mappings = (options.image ?? []).map(parseImageMapping);
11
+ const projects = getProjects(tree);
12
+ validateMappings(projects, mappings);
13
+ validateIdentities(repository, deployable, mappings);
14
+ const root = joinPathFragments('.argocd', 'deployables', deployable);
15
+ const projectName = `deployable-${deployable}`;
16
+ assertGenerationPathsAreAvailable(tree, projects, projectName, root, mappings);
17
+ const values = tree.read(chartValues, 'utf8');
18
+ if (!values)
19
+ throw new Error(`[nx-argo] Could not read ${chartValues}.`);
20
+ const document = parseDocument(values);
21
+ if (document.errors.length)
22
+ throw new Error(`[nx-argo] ${chartValues} is not valid YAML.`);
23
+ for (const environment of environments)
24
+ validateIngressValues(document.toJS(), repository, deployable, environment);
25
+ addProjectConfiguration(tree, projectName, {
26
+ root,
27
+ projectType: 'application',
28
+ tags: ['type:deployable', `scope:${deployable}`],
29
+ metadata: {
30
+ argo: {
31
+ chartProject: options.chartProject,
32
+ chartRepository: options.chartRepository ?? '',
33
+ chartVersion: options.chartVersion ?? '',
34
+ imageMappings: mappings,
35
+ },
36
+ },
37
+ });
38
+ for (const environment of environments) {
39
+ tree.write(joinPathFragments(root, environment, 'state.yaml'), stringify({
40
+ deployable,
41
+ registered: false,
42
+ enabled: false,
43
+ chart: {
44
+ repository: options.chartRepository ?? '',
45
+ version: options.chartVersion ?? '',
46
+ },
47
+ }, { lineWidth: 0 }));
48
+ tree.write(joinPathFragments(root, environment, 'values.yaml'), values);
49
+ if (mappings.length)
50
+ tree.write(joinPathFragments(root, environment, 'image-updater.yaml'), stringify(policy(repository, githubUrl, deployable, environment, mappings), { lineWidth: 0 }));
51
+ }
52
+ }
53
+ function chartValuesPath(tree, chartProject) {
54
+ const chart = readProjectConfiguration(tree, chartProject);
55
+ const chartManifest = joinPathFragments(chart.root, 'Chart.yaml');
56
+ const chartValues = joinPathFragments(chart.root, 'values.yaml');
57
+ if (!tree.exists(chartManifest))
58
+ throw new Error(`[nx-argo] ${chartProject} must be a standalone chart with Chart.yaml.`);
59
+ if (!tree.exists(chartValues))
60
+ throw new Error(`[nx-argo] ${chartProject} must have a root values.yaml.`);
61
+ return chartValues;
62
+ }
63
+ function validateMappings(projects, mappings) {
64
+ const aliases = new Set();
65
+ for (const mapping of mappings) {
66
+ if (aliases.has(mapping.project))
67
+ throw new Error(`[nx-argo] Duplicate image mapping project ${mapping.project}.`);
68
+ if (!projects.has(mapping.project))
69
+ throw new Error(`[nx-argo] Unknown image mapping project ${mapping.project}.`);
70
+ aliases.add(mapping.project);
71
+ }
72
+ }
73
+ function validateIdentities(repository, deployable, mappings) {
74
+ for (const environment of environments) {
75
+ namespaceFor(repository, deployable, environment);
76
+ hostnameFor(repository, deployable, deployable, environment);
77
+ for (const mapping of mappings)
78
+ hostnameFor(repository, deployable, mapping.project, environment);
79
+ }
80
+ }
81
+ function assertGenerationPathsAreAvailable(tree, projects, projectName, root, mappings) {
82
+ if (projects.has(projectName))
83
+ throw new Error(`[nx-argo] Refusing to overwrite existing Nx project ${projectName}.`);
84
+ for (const file of generatedPaths(root, mappings))
85
+ if (tree.exists(file))
86
+ throw new Error(`[nx-argo] Refusing to overwrite ${file}.`);
87
+ }
88
+ function generatedPaths(root, mappings) {
89
+ return [
90
+ joinPathFragments(root, 'project.json'),
91
+ ...environments.flatMap((environment) => [
92
+ joinPathFragments(root, environment, 'state.yaml'),
93
+ joinPathFragments(root, environment, 'values.yaml'),
94
+ ...(mappings.length
95
+ ? [joinPathFragments(root, environment, 'image-updater.yaml')]
96
+ : []),
97
+ ]),
98
+ ];
99
+ }
100
+ function requiredLabel(value, field) {
101
+ assertLabel(value, field);
102
+ return value;
103
+ }
104
+ function parseImageMapping(input) {
105
+ const values = Object.fromEntries(input.split(',').map((part) => {
106
+ const index = part.indexOf('=');
107
+ if (index < 1 || part.indexOf('=', index + 1) !== -1)
108
+ throw new Error('[nx-argo] image mappings must use key=value comma-separated fields.');
109
+ return [part.slice(0, index), part.slice(index + 1)];
110
+ }));
111
+ const expected = ['project', 'imageName', 'repositoryPath', 'tagPath'];
112
+ if (Object.keys(values).length !== expected.length ||
113
+ expected.some((key) => !values[key]))
114
+ throw new Error('[nx-argo] image mappings require project, imageName, repositoryPath, and tagPath.');
115
+ assertLabel(values['project'], 'image mapping project');
116
+ return {
117
+ project: values['project'],
118
+ imageName: values['imageName'],
119
+ repositoryPath: values['repositoryPath'],
120
+ tagPath: values['tagPath'],
121
+ };
122
+ }
123
+ function policy(repository, githubUrl, deployable, environment, mappings) {
124
+ const staging = environment === 'staging';
125
+ return {
126
+ apiVersion: 'argocd-image-updater.argoproj.io/v1alpha1',
127
+ kind: 'ImageUpdater',
128
+ metadata: {
129
+ name: `${repository}-${deployable}-${environment}`,
130
+ namespace: 'argocd',
131
+ },
132
+ spec: {
133
+ applicationRefs: [
134
+ {
135
+ namePattern: `${repository}-${deployable}-${environment}`,
136
+ images: mappings.map((mapping) => ({
137
+ alias: mapping.project,
138
+ imageName: mapping.imageName,
139
+ commonUpdateSettings: {
140
+ updateStrategy: staging ? 'newest-build' : 'semver',
141
+ allowTags: staging
142
+ ? 'regexp:^.+-staging\\.[0-9]+$'
143
+ : 'regexp:^[0-9]+\\.[0-9]+\\.[0-9]+$',
144
+ },
145
+ manifestTargets: {
146
+ helm: { name: mapping.repositoryPath, tag: mapping.tagPath },
147
+ },
148
+ })),
149
+ },
150
+ ],
151
+ writeBackConfig: {
152
+ method: 'git:secret:argocd/argocd-github-otwld-repo-creds',
153
+ gitConfig: {
154
+ repository: githubUrl,
155
+ writeBackTarget: `helmvalues:./.argocd/deployables/${deployable}/${environment}/values.yaml`,
156
+ pullRequest: { github: {} },
157
+ },
158
+ },
159
+ },
160
+ };
161
+ }
162
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../../../plugins/nx/argo/src/generators/register.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EACjB,wBAAwB,GAEzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,2BAA2B,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,EAClB,WAA0C,EAC1C,QAAwB;IAExB,MAAM,OAAO,GAAG,WAAW,KAAK,SAAS,CAAC;IAC1C,OAAO;QACL,UAAU,EAAE,2CAA2C;QACvD,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE;YACR,IAAI,EAAE,GAAG,UAAU,IAAI,UAAU,IAAI,WAAW,EAAE;YAClD,SAAS,EAAE,QAAQ;SACpB;QACD,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf;oBACE,WAAW,EAAE,GAAG,UAAU,IAAI,UAAU,IAAI,WAAW,EAAE;oBACzD,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;wBACjC,KAAK,EAAE,OAAO,CAAC,OAAO;wBACtB,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,oBAAoB,EAAE;4BACpB,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ;4BACnD,SAAS,EAAE,OAAO;gCAChB,CAAC,CAAC,8BAA8B;gCAChC,CAAC,CAAC,mCAAmC;yBACxC;wBACD,eAAe,EAAE;4BACf,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE;yBAC7D;qBACF,CAAC,CAAC;iBACJ;aACF;YACD,eAAe,EAAE;gBACf,MAAM,EAAE,kDAAkD;gBAC1D,SAAS,EAAE;oBACT,UAAU,EAAE,SAAS;oBACrB,eAAe,EAAE,oCAAoC,UAAU,IAAI,WAAW,cAAc;oBAC5F,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;iBAC5B;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "type": "object",
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "chartProject": {
7
+ "type": "string",
8
+ "$default": { "source": "argv", "index": 0 }
9
+ },
10
+ "deployable": { "type": "string" },
11
+ "chartRepository": { "type": "string" },
12
+ "chartVersion": { "type": "string" },
13
+ "image": { "type": "array", "items": { "type": "string" } }
14
+ },
15
+ "required": ["chartProject", "deployable"]
16
+ }
package/src/index.d.ts CHANGED
@@ -1,21 +1,4 @@
1
- /** Public generator and executor exports for the Argo CD package. */
2
- export { default as environmentProjectGenerator } from './generators/environment-project/environment-project';
3
- export type { EnvironmentProjectGeneratorSchema } from './generators/environment-project/schema';
4
- export { default as previewProjectGenerator } from './generators/preview-project/preview-project';
5
- export type { PreviewProjectGeneratorSchema } from './generators/preview-project/schema';
6
- export { default as stackProjectGenerator } from './generators/stack-project/stack-project';
7
- export type { StackProjectGeneratorSchema, StackRepository, StackValueFiles, } from './generators/stack-project/schema';
8
- export { default as validateApplication } from './executors/validate-application/validate-application';
9
- export type { ValidateApplicationExecutorSchema } from './executors/validate-application/schema';
10
- export { default as validateApplicationSet } from './executors/validate-application-set/validate-application-set';
11
- export type { ValidateApplicationSetExecutorSchema } from './executors/validate-application-set/schema';
12
- export { default as validateImageLock } from './executors/validate-image-lock/validate-image-lock';
13
- export type { ValidateImageLockExecutorSchema } from './executors/validate-image-lock/schema';
14
- export { default as writeImageLock } from './executors/write-image-lock/write-image-lock';
15
- export type { WriteImageLockExecutorSchema } from './executors/write-image-lock/schema';
16
- export { default as copyImageLock } from './executors/copy-image-lock/copy-image-lock';
17
- export type { CopyImageLockExecutorSchema } from './executors/copy-image-lock/schema';
18
- export { default as setSourceRevision } from './executors/set-source-revision/set-source-revision';
19
- export type { SetSourceRevisionExecutorSchema } from './executors/set-source-revision/schema';
20
- export { default as copySourceRevision } from './executors/copy-source-revision/copy-source-revision';
21
- export type { CopySourceRevisionExecutorSchema } from './executors/copy-source-revision/schema';
1
+ export { createNodes } from './plugin.js';
2
+ export { default as registerGenerator } from './generators/register.js';
3
+ export { default as validateExecutor } from './executors/validate.js';
4
+ export * from './names.js';
package/src/index.js CHANGED
@@ -1,26 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copySourceRevision = exports.setSourceRevision = exports.copyImageLock = exports.writeImageLock = exports.validateImageLock = exports.validateApplicationSet = exports.validateApplication = exports.stackProjectGenerator = exports.previewProjectGenerator = exports.environmentProjectGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
- /** Public generator and executor exports for the Argo CD package. */
6
- var environment_project_1 = require("./generators/environment-project/environment-project");
7
- Object.defineProperty(exports, "environmentProjectGenerator", { enumerable: true, get: function () { return tslib_1.__importDefault(environment_project_1).default; } });
8
- var preview_project_1 = require("./generators/preview-project/preview-project");
9
- Object.defineProperty(exports, "previewProjectGenerator", { enumerable: true, get: function () { return tslib_1.__importDefault(preview_project_1).default; } });
10
- var stack_project_1 = require("./generators/stack-project/stack-project");
11
- Object.defineProperty(exports, "stackProjectGenerator", { enumerable: true, get: function () { return tslib_1.__importDefault(stack_project_1).default; } });
12
- var validate_application_1 = require("./executors/validate-application/validate-application");
13
- Object.defineProperty(exports, "validateApplication", { enumerable: true, get: function () { return tslib_1.__importDefault(validate_application_1).default; } });
14
- var validate_application_set_1 = require("./executors/validate-application-set/validate-application-set");
15
- Object.defineProperty(exports, "validateApplicationSet", { enumerable: true, get: function () { return tslib_1.__importDefault(validate_application_set_1).default; } });
16
- var validate_image_lock_1 = require("./executors/validate-image-lock/validate-image-lock");
17
- Object.defineProperty(exports, "validateImageLock", { enumerable: true, get: function () { return tslib_1.__importDefault(validate_image_lock_1).default; } });
18
- var write_image_lock_1 = require("./executors/write-image-lock/write-image-lock");
19
- Object.defineProperty(exports, "writeImageLock", { enumerable: true, get: function () { return tslib_1.__importDefault(write_image_lock_1).default; } });
20
- var copy_image_lock_1 = require("./executors/copy-image-lock/copy-image-lock");
21
- Object.defineProperty(exports, "copyImageLock", { enumerable: true, get: function () { return tslib_1.__importDefault(copy_image_lock_1).default; } });
22
- var set_source_revision_1 = require("./executors/set-source-revision/set-source-revision");
23
- Object.defineProperty(exports, "setSourceRevision", { enumerable: true, get: function () { return tslib_1.__importDefault(set_source_revision_1).default; } });
24
- var copy_source_revision_1 = require("./executors/copy-source-revision/copy-source-revision");
25
- Object.defineProperty(exports, "copySourceRevision", { enumerable: true, get: function () { return tslib_1.__importDefault(copy_source_revision_1).default; } });
1
+ export { createNodes } from './plugin.js';
2
+ export { default as registerGenerator } from './generators/register.js';
3
+ export { default as validateExecutor } from './executors/validate.js';
4
+ export * from './names.js';
26
5
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../plugins/nx/argo/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,4FAA8G;AAArG,2JAAA,OAAO,OAA+B;AAE/C,gFAAkG;AAAzF,mJAAA,OAAO,OAA2B;AAE3C,0EAA4F;AAAnF,+IAAA,OAAO,OAAyB;AAMzC,8FAAuG;AAA9F,oJAAA,OAAO,OAAuB;AAEvC,0GAAkH;AAAzG,2JAAA,OAAO,OAA0B;AAE1C,2FAAmG;AAA1F,iJAAA,OAAO,OAAqB;AAErC,kFAA0F;AAAjF,2IAAA,OAAO,OAAkB;AAElC,+EAAuF;AAA9E,yIAAA,OAAO,OAAiB;AAEjC,2FAAmG;AAA1F,iJAAA,OAAO,OAAqB;AAErC,8FAAsG;AAA7F,mJAAA,OAAO,OAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../plugins/nx/argo/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,cAAc,YAAY,CAAC"}
package/src/names.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export declare function assertLabel(value: string, field: string): void;
2
+ export declare function assertEnvironment(value: string): asserts value is 'staging' | 'production';
3
+ export declare function namespaceFor(repository: string, deployable: string, environment: string): string;
4
+ export declare function hostnameFor(repository: string, deployable: string, service: string, environment: string): string;
5
+ export declare function assertHostname(value: string, field: string): void;
6
+ export declare function validateIngressValues(value: unknown, repository: string, deployable: string, environment: 'staging' | 'production', owner?: string): void;
7
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
8
+ /** Resolves the consumer repository identity from its workspace directory. */
9
+ export declare function repositoryFromWorkspaceRoot(workspaceRoot: string): string;
10
+ /** Returns the one GitHub location supported by the V1 platform contract. */
11
+ export declare function githubUrlFor(repository: string): string;