@otwld/nx-argo 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
## Unreleased
|
|
2
2
|
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- Make stable staging Applications descriptor-driven for generated stack projects.
|
|
6
|
+
|
|
3
7
|
### Breaking changes
|
|
4
8
|
|
|
5
9
|
- Generate and validate `values-preview.yaml` as the only pull-request preview
|
|
6
10
|
values path.
|
|
11
|
+
- Stop generating `application-staging.yaml`; stable staging Applications are
|
|
12
|
+
generated from repository delivery descriptors.
|
|
13
|
+
- Stop generating the `validate-application-staging` target for stack projects.
|
|
7
14
|
|
|
8
15
|
## 0.0.8 (2026-08-12)
|
|
9
16
|
|
package/README.md
CHANGED
|
@@ -12,16 +12,18 @@ pnpm exec nx g @otwld/nx-argo:environment-project web \
|
|
|
12
12
|
--imageLock --applicationFile=application.yaml
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`preview-project` creates `gitops/previews/<name>/project.json` with optional `dependencies`, generic preview metadata, and `validate-application-set`. `applicationSetFile` defaults to `application-set.yaml`. The optional `github-pr-preview` policy is the only GitHub-specific behavior.
|
|
15
|
+
`preview-project` creates `gitops/previews/<name>/project.json` with optional `dependencies`, generic preview metadata, and `validate-application-set`. `applicationSetFile` defaults to `application-set.yaml`. The optional `github-pr-preview` policy is the only GitHub-specific behavior. Environment and preview projects are validation boundaries only; they do not declare `delivery:stack-*` targets. Only `stack-project` explicitly opts into application-stack delivery.
|
|
16
16
|
|
|
17
17
|
```shell
|
|
18
18
|
pnpm exec nx g @otwld/nx-argo:preview-project web \
|
|
19
19
|
--dependencies=frontend,backend --policy=github-pr-preview
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
`stack-project` creates one complete boundary at `gitops/<stack
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
`stack-project` creates one complete boundary at `gitops/<stack>` and registers
|
|
23
|
+
its Argo resources in the repository-root `kustomization.yaml`. It writes the
|
|
24
|
+
production Application, stable staging/production/preview values, and an
|
|
25
|
+
optional GitHub pull-request ApplicationSet. Add a `delivery.yaml` descriptor
|
|
26
|
+
for the repository-owned stable staging ApplicationSet. The stack project declares
|
|
25
27
|
the chart and every mapped application as `implicitDependencies` and records the
|
|
26
28
|
delivery contract consumed by `@otwld/nx-delivery`. It also declares the four
|
|
27
29
|
`delivery:stack-*` targets; install `@otwld/nx-delivery` before invoking them:
|
|
@@ -60,7 +62,8 @@ and all file paths are explicit; the generator does not assume a frontend,
|
|
|
60
62
|
backend, web, or repository name. The pull-request policy requires repository
|
|
61
63
|
owner/name and uses `values-preview.yaml` as its final Helm value file. Its
|
|
62
64
|
ApplicationSet resolves the chart and values sources from the same `preview/pr-N`
|
|
63
|
-
snapshot revision
|
|
65
|
+
snapshot revision and defaults to the platform-provided `argocd-github-otwld`
|
|
66
|
+
token Secret; use `githubTokenSecretName` only for an explicit override.
|
|
64
67
|
|
|
65
68
|
## Contracts
|
|
66
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otwld/nx-argo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"exports": {
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"executors": "./executors.json",
|
|
31
|
+
"generators": "./generators.json"
|
|
32
32
|
}
|
|
@@ -40,7 +40,7 @@ export interface StackProjectGeneratorSchema {
|
|
|
40
40
|
argoProject?: string;
|
|
41
41
|
/** Optional ApplicationSet policy for GitHub pull-request previews. */
|
|
42
42
|
policy?: 'github-pr-preview';
|
|
43
|
-
/** GitHub token secret name used by the optional preview generator. */
|
|
43
|
+
/** GitHub token secret name used by the optional preview generator. Defaults to the organization credential. */
|
|
44
44
|
githubTokenSecretName?: string;
|
|
45
45
|
/** GitHub token secret key used by the optional preview generator. */
|
|
46
46
|
githubTokenSecretKey?: string;
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"githubTokenSecretName": {
|
|
75
75
|
"type": "string",
|
|
76
|
-
"description": "GitHub token secret name for the preview generator."
|
|
76
|
+
"description": "GitHub token secret name for the preview generator.",
|
|
77
|
+
"default": "argocd-github-otwld"
|
|
77
78
|
},
|
|
78
79
|
"githubTokenSecretKey": {
|
|
79
80
|
"type": "string",
|
|
@@ -81,7 +81,7 @@ async function stackProjectGenerator(tree, options) {
|
|
|
81
81
|
}
|
|
82
82
|
/** Registers generated Argo resources in the workspace GitOps catalog. */
|
|
83
83
|
function updateKustomization(tree, generatedFiles) {
|
|
84
|
-
const file = '
|
|
84
|
+
const file = 'kustomization.yaml';
|
|
85
85
|
const document = tree.exists(file)
|
|
86
86
|
? (0, yaml_1.parse)(tree.read(file, 'utf8') ?? '')
|
|
87
87
|
: {
|
|
@@ -100,19 +100,17 @@ function updateKustomization(tree, generatedFiles) {
|
|
|
100
100
|
...(generatedFiles.applicationSetFile
|
|
101
101
|
? [generatedFiles.applicationSetFile]
|
|
102
102
|
: []),
|
|
103
|
-
]
|
|
103
|
+
];
|
|
104
104
|
document['resources'] = [...new Set([...resources, ...generatedResources])];
|
|
105
105
|
tree.write(file, (0, yaml_1.stringify)(document, { lineWidth: 0 }));
|
|
106
106
|
}
|
|
107
107
|
/** Builds all Argo manifests and stable value files owned by the boundary. */
|
|
108
108
|
function getGeneratedFiles(directory, stack, chartPath, namespacePrefix, repository, values, applications, options) {
|
|
109
109
|
const applicationFiles = {
|
|
110
|
-
staging: (0, devkit_1.joinPathFragments)(directory, 'application-staging.yaml'),
|
|
111
110
|
production: (0, devkit_1.joinPathFragments)(directory, 'application-production.yaml'),
|
|
112
111
|
};
|
|
113
112
|
const files = {
|
|
114
|
-
[applicationFiles.
|
|
115
|
-
[applicationFiles.production]: (0, yaml_1.stringify)(createApplication(stack, 'production', chartPath, namespacePrefix, repository, values.production, directory, options.argoProject), { lineWidth: 0 }),
|
|
113
|
+
[applicationFiles.production]: (0, yaml_1.stringify)(createApplication(stack, chartPath, namespacePrefix, repository, values.production, directory, options.argoProject), { lineWidth: 0 }),
|
|
116
114
|
};
|
|
117
115
|
for (const environment of ['staging', 'production', 'preview']) {
|
|
118
116
|
files[(0, devkit_1.joinPathFragments)(directory, values[environment])] = (0, yaml_1.stringify)(createValues(applications, environment), { lineWidth: 0 });
|
|
@@ -124,8 +122,8 @@ function getGeneratedFiles(directory, stack, chartPath, namespacePrefix, reposit
|
|
|
124
122
|
}
|
|
125
123
|
return { applicationFiles, applicationSetFile, files };
|
|
126
124
|
}
|
|
127
|
-
/** Creates
|
|
128
|
-
function createApplication(stack,
|
|
125
|
+
/** Creates the stable Argo CD production Application. */
|
|
126
|
+
function createApplication(stack, chartPath, namespacePrefix, repository, valuesFile, directory, argoProject = 'default') {
|
|
129
127
|
const repositoryUrl = repository.url;
|
|
130
128
|
const repositoryRevision = repository.revision;
|
|
131
129
|
const gitopsValuesPath = (0, devkit_1.joinPathFragments)(directory, valuesFile);
|
|
@@ -133,7 +131,7 @@ function createApplication(stack, environment, chartPath, namespacePrefix, repos
|
|
|
133
131
|
apiVersion: 'argoproj.io/v1alpha1',
|
|
134
132
|
kind: 'Application',
|
|
135
133
|
metadata: {
|
|
136
|
-
name: `${stack}
|
|
134
|
+
name: `${stack}-production`,
|
|
137
135
|
namespace: 'argocd',
|
|
138
136
|
},
|
|
139
137
|
spec: {
|
|
@@ -153,7 +151,7 @@ function createApplication(stack, environment, chartPath, namespacePrefix, repos
|
|
|
153
151
|
],
|
|
154
152
|
destination: {
|
|
155
153
|
server: 'https://kubernetes.default.svc',
|
|
156
|
-
namespace: `${namespacePrefix}
|
|
154
|
+
namespace: `${namespacePrefix}-production`,
|
|
157
155
|
},
|
|
158
156
|
syncPolicy: {
|
|
159
157
|
syncOptions: ['CreateNamespace=true'],
|
|
@@ -168,7 +166,7 @@ function createApplication(stack, environment, chartPath, namespacePrefix, repos
|
|
|
168
166
|
/** Creates the optional GitHub pull-request ApplicationSet using preview values. */
|
|
169
167
|
function createApplicationSet(stack, chartPath, namespacePrefix, repository, valuesFile, directory, options) {
|
|
170
168
|
const repositoryUrl = repository.url;
|
|
171
|
-
const secretName = options.githubTokenSecretName?.trim() ||
|
|
169
|
+
const secretName = options.githubTokenSecretName?.trim() || 'argocd-github-otwld';
|
|
172
170
|
const secretKey = options.githubTokenSecretKey?.trim() || 'token';
|
|
173
171
|
const previewLabel = options.previewLabel?.trim() || 'preview-ready';
|
|
174
172
|
const revision = options.requeueAfterSeconds ?? 1800;
|
|
@@ -275,10 +273,6 @@ function createValues(applications, environment) {
|
|
|
275
273
|
/** Declares Argo validation targets for generated manifests. */
|
|
276
274
|
function getValidationTargets(files, options) {
|
|
277
275
|
const targets = {
|
|
278
|
-
'validate-application-staging': {
|
|
279
|
-
executor: '@otwld/nx-argo:validate-application',
|
|
280
|
-
options: { file: relativeToProject(files.applicationFiles.staging) },
|
|
281
|
-
},
|
|
282
276
|
'validate-application-production': {
|
|
283
277
|
executor: '@otwld/nx-argo:validate-application',
|
|
284
278
|
options: { file: relativeToProject(files.applicationFiles.production) },
|