@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
@@ -1,56 +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
- /** Writes or verifies an immutable image lock for a source revision. */
6
- const runExecutor = async (options, context) => {
7
- if (!(0, shared_1.isNonEmptyString)(options.repository) || !(0, shared_1.isDigest)(options.digest)) {
8
- throw new Error('[nx-argo] An image repository and immutable sha256 digest are required.');
9
- }
10
- if (!(0, shared_1.isNonEmptyString)(options.service) ||
11
- !(0, shared_1.isNonEmptyString)(options.sourceRevision)) {
12
- throw new Error('[nx-argo] A service and source revision are required.');
13
- }
14
- const filePath = (0, shared_1.resolveProjectFile)((0, shared_1.getProjectRoot)(context), options.file, 'Image lock file');
15
- const lock = (0, shared_1.readYamlMapping)(filePath, 'image lock');
16
- const paths = (0, image_lock_1.getImageLockPaths)(options);
17
- const isPending = (0, shared_1.getPath)(lock, ['artifact', 'pending']) === true;
18
- if (isPending) {
19
- const pendingValues = [
20
- (0, shared_1.getPath)(lock, paths.repository),
21
- (0, shared_1.getPath)(lock, paths.digest),
22
- (0, shared_1.getPath)(lock, paths.service),
23
- (0, shared_1.getPath)(lock, paths.sourceRevision),
24
- ];
25
- if (!pendingValues.every((value) => value === '')) {
26
- throw new Error('[nx-argo] Pending image locks require empty image-lock values.');
27
- }
28
- (0, shared_1.setPath)(lock, ['artifact', 'pending'], false);
29
- }
30
- const existingRevision = (0, shared_1.getPath)(lock, paths.sourceRevision);
31
- if (!isPending &&
32
- existingRevision !== undefined &&
33
- !(0, shared_1.isNonEmptyString)(existingRevision)) {
34
- throw new Error('[nx-argo] Image-lock source revision must be a string.');
35
- }
36
- if (!isPending && existingRevision === options.sourceRevision) {
37
- verifyValue(lock, paths.repository, options.repository, 'repository');
38
- verifyValue(lock, paths.digest, options.digest, 'digest');
39
- verifyValue(lock, paths.service, options.service, 'service');
40
- return { success: true };
41
- }
42
- (0, shared_1.setPath)(lock, paths.repository, options.repository);
43
- (0, shared_1.setPath)(lock, paths.digest, options.digest);
44
- (0, shared_1.setPath)(lock, paths.service, options.service);
45
- (0, shared_1.setPath)(lock, paths.sourceRevision, options.sourceRevision);
46
- (0, shared_1.writeYamlMapping)(filePath, lock);
47
- return { success: true };
48
- };
49
- /** Verifies a value recorded for an idempotent source-revision write. */
50
- function verifyValue(lock, path, expected, label) {
51
- if ((0, shared_1.getPath)(lock, path) !== expected) {
52
- throw new Error(`[nx-argo] Image-lock ${label} conflicts with the existing source revision.`);
53
- }
54
- }
55
- exports.default = runExecutor;
56
- //# sourceMappingURL=write-image-lock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-image-lock.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/executors/write-image-lock/write-image-lock.ts"],"names":[],"mappings":";;AAEA,8CAAkD;AAClD,sCASmB;AAInB,wEAAwE;AACxE,MAAM,WAAW,GAAkD,KAAK,EACtE,OAAO,EACP,OAAO,EACP,EAAE;IACF,IAAI,CAAC,IAAA,yBAAgB,EAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAA,iBAAQ,EAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,IACE,CAAC,IAAA,yBAAgB,EAAC,OAAO,CAAC,OAAO,CAAC;QAClC,CAAC,IAAA,yBAAgB,EAAC,OAAO,CAAC,cAAc,CAAC,EACzC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GA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chema } from './schema';
3
- /** Creates a generic GitOps project boundary for one environment. */
4
- export default function environmentProjectGenerator(tree: Tree, options: EnvironmentProjectGeneratorSchema): Promise<void>;
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = environmentProjectGenerator;
4
- const devkit_1 = require("@nx/devkit");
5
- /** Creates a generic GitOps project boundary for one environment. */
6
- async function environmentProjectGenerator(tree, options) {
7
- const name = getName(options.name, 'name');
8
- const service = getName(options.service, 'service');
9
- const environment = getName(options.environment, 'environment');
10
- const directory = (0, devkit_1.joinPathFragments)(options.directory?.trim() || 'gitops/environments', name, environment);
11
- const projectFile = (0, devkit_1.joinPathFragments)(directory, 'project.json');
12
- if (tree.exists(projectFile)) {
13
- throw new Error(`[nx-argo] A GitOps environment project already exists at ${directory}.`);
14
- }
15
- (0, devkit_1.writeJson)(tree, projectFile, {
16
- name: `gitops-${name}-${environment}`,
17
- root: directory,
18
- projectType: 'application',
19
- tags: [
20
- 'type:gitops',
21
- `deployment:${name}`,
22
- `service:${service}`,
23
- `environment:${environment}`,
24
- ],
25
- implicitDependencies: getDependencies(options),
26
- metadata: {
27
- delivery: {
28
- name,
29
- service,
30
- environment,
31
- },
32
- },
33
- targets: getTargets(options),
34
- });
35
- tree.write((0, devkit_1.joinPathFragments)(directory, 'values.yaml'), '# Environment configuration owned by humans.\n{}\n');
36
- if (options.imageLock) {
37
- tree.write((0, devkit_1.joinPathFragments)(directory, 'artifacts.yaml'), "# Immutable image lock written by automation.\nartifact:\n pending: true\n service: ''\n sourceRevision: ''\nimage:\n repository: ''\n digest: ''\n");
38
- }
39
- if (!options.skipFormat) {
40
- await (0, devkit_1.formatFiles)(tree);
41
- }
42
- }
43
- /** Declares only the targets needed by files selected for this project. */
44
- function getTargets(options) {
45
- const targets = {};
46
- if (options.applicationFile) {
47
- targets['validate-application'] = {
48
- executor: '@otwld/nx-argo:validate-application',
49
- options: {
50
- file: options.applicationFile,
51
- ...(options.imageLock ? { finalValueFile: 'artifacts.yaml' } : {}),
52
- },
53
- };
54
- }
55
- if (options.imageLock) {
56
- targets['validate-image-lock'] = {
57
- executor: '@otwld/nx-argo:validate-image-lock',
58
- options: { file: 'artifacts.yaml' },
59
- };
60
- targets['write-image-lock'] = {
61
- executor: '@otwld/nx-argo:write-image-lock',
62
- cache: false,
63
- options: {
64
- file: 'artifacts.yaml',
65
- repositoryPath: 'image.repository',
66
- digestPath: 'image.digest',
67
- servicePath: 'artifact.service',
68
- sourceRevisionPath: 'artifact.sourceRevision',
69
- },
70
- };
71
- }
72
- return targets;
73
- }
74
- /** Builds deduplicated project dependencies from all selected inputs. */
75
- function getDependencies(options) {
76
- return [
77
- ...new Set([...(options.dependencies ?? []), options.chartProject]
78
- .filter((dependency) => Boolean(dependency?.trim()))
79
- .map((dependency) => dependency.trim())),
80
- ];
81
- }
82
- /** Normalizes an identifier used in directory and tag names. */
83
- function getName(value, label) {
84
- const normalized = (0, devkit_1.names)(requireValue(value, label)).fileName;
85
- if (!normalized) {
86
- throw new Error(`[nx-argo] A ${label} is required.`);
87
- }
88
- return normalized;
89
- }
90
- /** Requires a non-empty option. */
91
- function requireValue(value, label) {
92
- const normalized = value?.trim();
93
- if (!normalized) {
94
- throw new Error(`[nx-argo] A ${label} is required.`);
95
- }
96
- return normalized;
97
- }
98
- //# sourceMappingURL=environment-project.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-project.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/generators/environment-project/environment-project.ts"],"names":[],"mappings":";;AAWA,8CAsDC;AAjED,uCAMoB;AAIpB,qEAAqE;AACtD,KAAK,UAAU,2BAA2B,CACvD,IAAU,EACV,OAA0C;IAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACpD,MAAM,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;KACF,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,SAAS,OAAO,CAAC,KAAa,EAAE,KAAa;IAC3C,MAAM,UAAU,GAAG,IAAA,cAAK,EAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,mCAAmC;AACnC,SAAS,YAAY,CAAC,KAAyB,EAAE,KAAa;IAC5D,MAAM,UAAU,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,21 +0,0 @@
1
- /** Options accepted by the GitOps environment project generator. */
2
- export interface EnvironmentProjectGeneratorSchema {
3
- /** Deployment name used for the project boundary and directory. */
4
- name: string;
5
- /** Deployment service identity recorded in metadata. */
6
- service: string;
7
- /** Environment represented by the generated GitOps project. */
8
- environment: string;
9
- /** Nx projects this GitOps project implicitly depends on. */
10
- dependencies?: string[];
11
- /** Optional Nx chart project dependency. */
12
- chartProject?: string;
13
- /** Create the canonical artifacts.yaml image lock and its targets. */
14
- imageLock?: boolean;
15
- /** Optional declared Application file relative to the generated project. */
16
- applicationFile?: string;
17
- /** Parent directory for generated GitOps environments. */
18
- directory?: string;
19
- /** Skip Prettier formatting after generation. */
20
- skipFormat?: boolean;
21
- }
@@ -1,55 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxArgoEnvironmentProjectGeneratorSchema",
4
- "title": "GitOps environment project generator",
5
- "description": "Create an Nx GitOps project for one environment.",
6
- "type": "object",
7
- "properties": {
8
- "name": {
9
- "type": "string",
10
- "description": "Deployment name used for the project boundary and directory.",
11
- "$default": { "source": "argv", "index": 0 },
12
- "x-priority": "important"
13
- },
14
- "service": {
15
- "type": "string",
16
- "description": "Deployment service identity recorded in metadata.",
17
- "x-priority": "important"
18
- },
19
- "environment": {
20
- "type": "string",
21
- "description": "Environment represented by this GitOps project.",
22
- "x-priority": "important"
23
- },
24
- "dependencies": {
25
- "type": "array",
26
- "description": "Nx projects this GitOps project implicitly depends on.",
27
- "items": { "type": "string" }
28
- },
29
- "chartProject": {
30
- "type": "string",
31
- "description": "Optional Nx chart project dependency."
32
- },
33
- "imageLock": {
34
- "type": "boolean",
35
- "description": "Create the canonical artifacts.yaml image lock and its targets.",
36
- "default": false
37
- },
38
- "applicationFile": {
39
- "type": "string",
40
- "description": "Optional declared Application file relative to the generated project."
41
- },
42
- "directory": {
43
- "type": "string",
44
- "description": "Parent directory for GitOps environments.",
45
- "default": "gitops/environments"
46
- },
47
- "skipFormat": {
48
- "type": "boolean",
49
- "description": "Skip Prettier formatting after generation.",
50
- "default": false
51
- }
52
- },
53
- "required": ["name", "service", "environment"],
54
- "additionalProperties": false
55
- }
@@ -1,4 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- import type { PreviewProjectGeneratorSchema } from './schema';
3
- /** Creates a generic GitOps project boundary for an ApplicationSet workflow. */
4
- export default function previewProjectGenerator(tree: Tree, options: PreviewProjectGeneratorSchema): Promise<void>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = previewProjectGenerator;
4
- const devkit_1 = require("@nx/devkit");
5
- /** Creates a generic GitOps project boundary for an ApplicationSet workflow. */
6
- async function previewProjectGenerator(tree, options) {
7
- const name = (0, devkit_1.names)(options.name?.trim() || '').fileName;
8
- const dependencies = [
9
- ...new Set(options.dependencies
10
- ?.map((dependency) => dependency.trim())
11
- .filter(Boolean)),
12
- ];
13
- const directory = (0, devkit_1.joinPathFragments)(options.directory?.trim() || 'gitops/previews', name);
14
- const projectFile = (0, devkit_1.joinPathFragments)(directory, 'project.json');
15
- if (!name) {
16
- throw new Error('[nx-argo] A preview name is required.');
17
- }
18
- if (tree.exists(projectFile)) {
19
- throw new Error(`[nx-argo] A GitOps preview project already exists at ${directory}.`);
20
- }
21
- (0, devkit_1.writeJson)(tree, projectFile, {
22
- name: `gitops-preview-${name}`,
23
- root: directory,
24
- projectType: 'application',
25
- tags: ['type:gitops', 'environment:preview', `stack:${name}`],
26
- implicitDependencies: dependencies,
27
- metadata: {
28
- delivery: {
29
- preview: {
30
- name,
31
- ...(options.policy ? { policy: options.policy } : {}),
32
- },
33
- },
34
- },
35
- targets: {
36
- 'validate-application-set': {
37
- executor: '@otwld/nx-argo:validate-application-set',
38
- options: {
39
- file: options.applicationSetFile ?? 'application-set.yaml',
40
- ...(options.policy ? { policy: options.policy } : {}),
41
- },
42
- },
43
- },
44
- });
45
- if (!options.skipFormat) {
46
- await (0, devkit_1.formatFiles)(tree);
47
- }
48
- }
49
- //# sourceMappingURL=preview-project.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preview-project.js","sourceRoot":"","sources":["../../../../../../../plugins/nx/argo/src/generators/preview-project/preview-project.ts"],"names":[],"mappings":";;AAWA,0CAuDC;AAlED,uCAMoB;AAIpB,gFAAgF;AACjE,KAAK,UAAU,uBAAuB,CACnD,IAAU,EACV,OAAsC;IAEtC,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;IACxD,MAAM,YAAY,GAAG;QACnB,GAAG,IAAI,GAAG,CACR,OAAO,CAAC,YAAY;YAClB,EAAE,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;aACvC,MAAM,CAAC,OAAO,CAAC,CACnB;KACF,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,OAAO,CAAC,SAAS,E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AC"}
@@ -1,15 +0,0 @@
1
- /** Options accepted by the GitOps preview project generator. */
2
- export interface PreviewProjectGeneratorSchema {
3
- /** Preview stack identity. */
4
- name: string;
5
- /** Nx projects this preview project implicitly depends on. */
6
- dependencies?: string[];
7
- /** Optional ApplicationSet policy to enforce. */
8
- policy?: 'github-pr-preview';
9
- /** Declared ApplicationSet file relative to the generated project. */
10
- applicationSetFile?: string;
11
- /** Parent directory for generated preview stacks. */
12
- directory?: string;
13
- /** Skip Prettier formatting after generation. */
14
- skipFormat?: boolean;
15
- }
@@ -1,42 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxArgoPreviewProjectGeneratorSchema",
4
- "title": "GitOps preview project generator",
5
- "description": "Create an Nx GitOps project for a generic ApplicationSet preview workflow.",
6
- "type": "object",
7
- "properties": {
8
- "name": {
9
- "type": "string",
10
- "description": "Preview stack identity.",
11
- "$default": { "source": "argv", "index": 0 },
12
- "x-priority": "important"
13
- },
14
- "dependencies": {
15
- "type": "array",
16
- "description": "Nx projects this preview project implicitly depends on.",
17
- "items": { "type": "string" }
18
- },
19
- "policy": {
20
- "type": "string",
21
- "enum": ["github-pr-preview"],
22
- "description": "Optional ApplicationSet policy to enforce."
23
- },
24
- "applicationSetFile": {
25
- "type": "string",
26
- "default": "application-set.yaml",
27
- "description": "Declared ApplicationSet file relative to the generated project."
28
- },
29
- "directory": {
30
- "type": "string",
31
- "description": "Parent directory for preview stacks.",
32
- "default": "gitops/previews"
33
- },
34
- "skipFormat": {
35
- "type": "boolean",
36
- "description": "Skip Prettier formatting after generation.",
37
- "default": false
38
- }
39
- },
40
- "required": ["name"],
41
- "additionalProperties": false
42
- }
@@ -1,51 +0,0 @@
1
- /** Repository identity used by generated Argo sources and preview generators. */
2
- export interface StackRepository {
3
- /** Full Git repository URL. */
4
- url?: string;
5
- /** GitHub owner used by the optional pull-request generator. */
6
- owner?: string;
7
- /** GitHub repository name used by the optional pull-request generator. */
8
- name?: string;
9
- }
10
-
11
- /** Explicit staging and preview value-file paths owned by the stack project. */
12
- export interface StackValueFiles {
13
- /** Staging value file relative to the GitOps project. */
14
- staging?: string;
15
- /** Preview base value file relative to the GitOps project. */
16
- preview?: string;
17
- }
18
-
19
- /** Options accepted by the managed staging and preview stack generator. */
20
- export interface StackProjectGeneratorSchema {
21
- /** Stack identity and generated directory suffix. */
22
- name: string;
23
- /** Workspace-relative Helm chart path used by generated Argo sources. */
24
- chartPath: string;
25
- /** Nx project name for the Helm chart. */
26
- chartProject: string;
27
- /** Values-key to Nx project mapping for direct stack image dependencies. */
28
- applications: Record<string, string>;
29
- /** Git repository identity used by generated Argo sources. */
30
- repository: StackRepository | string;
31
- /** Namespace prefix used for staging and pull-request destinations. */
32
- namespacePrefix: string;
33
- /** Explicit project-local staging and preview values paths. */
34
- values?: StackValueFiles;
35
- /** Argo CD project assigned to generated Applications. */
36
- argoProject?: string;
37
- /** Retained policy selector for GitHub pull-request preview options. */
38
- policy?: 'github-pr-preview';
39
- /** GitHub token secret name used by the optional preview generator. Defaults to the organization credential. */
40
- githubTokenSecretName?: string;
41
- /** GitHub token secret key used by the optional preview generator. */
42
- githubTokenSecretKey?: string;
43
- /** Pull-request label required by the preview generator. */
44
- previewLabel?: string;
45
- /** ApplicationSet pull-request polling interval in seconds. */
46
- requeueAfterSeconds?: number;
47
- /** Preview hostname passed to Helm as global.previewDomain. */
48
- previewDomain?: string;
49
- /** Skip Prettier formatting after generation. */
50
- skipFormat?: boolean;
51
- }
@@ -1,113 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxArgoStackProjectGeneratorSchema",
4
- "title": "GitOps stack project generator",
5
- "description": "Create one staging and preview GitOps boundary for a Helm application stack.",
6
- "type": "object",
7
- "properties": {
8
- "name": {
9
- "type": "string",
10
- "description": "Stack identity and generated directory suffix.",
11
- "$default": { "source": "argv", "index": 0 },
12
- "x-priority": "important"
13
- },
14
- "chartPath": {
15
- "type": "string",
16
- "description": "Workspace-relative Helm chart path used by Argo sources.",
17
- "x-priority": "important"
18
- },
19
- "chartProject": {
20
- "type": "string",
21
- "description": "Nx project name for the Helm chart.",
22
- "x-priority": "important"
23
- },
24
- "applications": {
25
- "type": "object",
26
- "description": "Values-key to Nx project mapping for stack image dependencies.",
27
- "minProperties": 1,
28
- "additionalProperties": { "type": "string", "minLength": 1 },
29
- "x-priority": "important"
30
- },
31
- "repository": {
32
- "description": "Repository URL or identity object used by Argo sources.",
33
- "oneOf": [
34
- { "type": "string", "minLength": 1 },
35
- {
36
- "type": "object",
37
- "properties": {
38
- "url": { "type": "string", "minLength": 1 },
39
- "owner": { "type": "string", "minLength": 1 },
40
- "name": { "type": "string", "minLength": 1 }
41
- },
42
- "additionalProperties": false,
43
- "minProperties": 1
44
- }
45
- ],
46
- "x-priority": "important"
47
- },
48
- "namespacePrefix": {
49
- "type": "string",
50
- "description": "Namespace prefix for staging and pull-request destinations.",
51
- "x-priority": "important"
52
- },
53
- "values": {
54
- "type": "object",
55
- "description": "Optional project-relative staging and preview value-file paths.",
56
- "properties": {
57
- "staging": { "type": "string", "minLength": 1 },
58
- "preview": { "type": "string", "minLength": 1 }
59
- },
60
- "additionalProperties": false
61
- },
62
- "argoProject": {
63
- "type": "string",
64
- "description": "Argo CD project assigned to generated Applications.",
65
- "default": "default"
66
- },
67
- "policy": {
68
- "type": "string",
69
- "enum": ["github-pr-preview"],
70
- "description": "Optional GitHub pull-request preview policy."
71
- },
72
- "githubTokenSecretName": {
73
- "type": "string",
74
- "description": "GitHub token secret name for the preview generator.",
75
- "default": "argocd-github-otwld"
76
- },
77
- "githubTokenSecretKey": {
78
- "type": "string",
79
- "description": "GitHub token secret key for the preview generator.",
80
- "default": "token"
81
- },
82
- "previewLabel": {
83
- "type": "string",
84
- "description": "Pull-request label required for preview generation.",
85
- "default": "preview-ready"
86
- },
87
- "requeueAfterSeconds": {
88
- "type": "integer",
89
- "minimum": 1,
90
- "description": "ApplicationSet pull-request polling interval in seconds.",
91
- "default": 1800
92
- },
93
- "previewDomain": {
94
- "type": "string",
95
- "description": "Preview hostname passed to Helm as global.previewDomain.",
96
- "default": "preview.otwld.com"
97
- },
98
- "skipFormat": {
99
- "type": "boolean",
100
- "description": "Skip Prettier formatting after generation.",
101
- "default": false
102
- }
103
- },
104
- "required": [
105
- "name",
106
- "chartPath",
107
- "chartProject",
108
- "applications",
109
- "repository",
110
- "namespacePrefix"
111
- ],
112
- "additionalProperties": false
113
- }
@@ -1,4 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- import type { StackProjectGeneratorSchema } from './schema';
3
- /** Creates one managed staging and preview boundary for a complete Helm stack. */
4
- export default function stackProjectGenerator(tree: Tree, options: StackProjectGeneratorSchema): Promise<void>;