@otwld/nx-argo 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -12,14 +12,15 @@ 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
|
|
22
|
+
`stack-project` creates one complete boundary at `gitops/<stack>` and registers
|
|
23
|
+
its Argo resources in the repository-root `kustomization.yaml`. It writes
|
|
23
24
|
staging and production Applications, stable staging/production/preview values,
|
|
24
25
|
and an optional GitHub pull-request ApplicationSet. The stack project declares
|
|
25
26
|
the chart and every mapped application as `implicitDependencies` and records the
|
|
@@ -60,7 +61,8 @@ and all file paths are explicit; the generator does not assume a frontend,
|
|
|
60
61
|
backend, web, or repository name. The pull-request policy requires repository
|
|
61
62
|
owner/name and uses `values-preview.yaml` as its final Helm value file. Its
|
|
62
63
|
ApplicationSet resolves the chart and values sources from the same `preview/pr-N`
|
|
63
|
-
snapshot revision
|
|
64
|
+
snapshot revision and defaults to the platform-provided `argocd-github-otwld`
|
|
65
|
+
token Secret; use `githubTokenSecretName` only for an explicit override.
|
|
64
66
|
|
|
65
67
|
## Contracts
|
|
66
68
|
|
package/package.json
CHANGED
|
@@ -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,7 +100,7 @@ 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
|
}
|
|
@@ -168,7 +168,7 @@ function createApplication(stack, environment, chartPath, namespacePrefix, repos
|
|
|
168
168
|
/** Creates the optional GitHub pull-request ApplicationSet using preview values. */
|
|
169
169
|
function createApplicationSet(stack, chartPath, namespacePrefix, repository, valuesFile, directory, options) {
|
|
170
170
|
const repositoryUrl = repository.url;
|
|
171
|
-
const secretName = options.githubTokenSecretName?.trim() ||
|
|
171
|
+
const secretName = options.githubTokenSecretName?.trim() || 'argocd-github-otwld';
|
|
172
172
|
const secretKey = options.githubTokenSecretKey?.trim() || 'token';
|
|
173
173
|
const previewLabel = options.previewLabel?.trim() || 'preview-ready';
|
|
174
174
|
const revision = options.requeueAfterSeconds ?? 1800;
|