@otwld/nx-argo 0.0.10 → 0.0.11

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,3 +1,10 @@
1
+ ## Unreleased
2
+
3
+ ### Breaking changes
4
+
5
+ - Generate and validate `values-preview.yaml` as the only pull-request preview
6
+ values path.
7
+
1
8
  ## 0.0.8 (2026-08-12)
2
9
 
3
10
  ### Breaking changes
package/README.md CHANGED
@@ -46,7 +46,6 @@ The canonical metadata shape is:
46
46
  "staging": "values-staging.yaml",
47
47
  "production": "values-production.yaml",
48
48
  "preview": "values-preview.yaml",
49
- "pullRequest": "values-pr.yaml",
50
49
  },
51
50
  "applications": { "services.api": "api" },
52
51
  },
@@ -59,7 +58,7 @@ The canonical metadata shape is:
59
58
  the generated values files. `chartPath`, repository identity, namespace prefix,
60
59
  and all file paths are explicit; the generator does not assume a frontend,
61
60
  backend, web, or repository name. The pull-request policy requires repository
62
- owner/name and generates a `values-pr.yaml` final Helm value file. Its preview
61
+ owner/name and uses `values-preview.yaml` as its final Helm value file. Its
63
62
  ApplicationSet resolves the chart and values sources from the same `preview/pr-N`
64
63
  snapshot revision.
65
64
 
@@ -67,7 +66,7 @@ snapshot revision.
67
66
 
68
67
  `validate-application` validates Application kind and spec. Its optional `finalValueFile` requires that basename to end each declared Helm `valueFiles` list; image locks are never implied.
69
68
 
70
- `validate-application-set` validates ApplicationSet kind, spec, template, and template spec. By default it imposes no provider rules. With `policy: github-pr-preview`, it also requires a pull request generator, literal template project, automated `enabled`, `prune`, and `selfHeal`, no `preserveResourcesOnDeletion`, and a PR lock as the final Helm values file.
69
+ `validate-application-set` validates ApplicationSet kind, spec, template, and template spec. By default it imposes no provider rules. With `policy: github-pr-preview`, it also requires a pull request generator, literal template project, automated `enabled`, `prune`, and `selfHeal`, no `preserveResourcesOnDeletion`, and `values-preview.yaml` as the final Helm values file.
71
70
 
72
71
  `validate-image-lock` uses canonical `image.repository`, `image.digest`, `artifact.service`, and `artifact.sourceRevision` paths unless mappings are supplied. `write-image-lock` requires explicit mapping paths. A pending lock contains exactly empty values; a completed lock has a nonempty repository, service, source revision, and SHA-256 digest. Writes require an existing project-local file, complete valid pending locks, and are idempotent for identical source-revision values.
73
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otwld/nx-argo",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -34,7 +34,7 @@ function validateGithubPrPreview(spec, templateSpec, filePath) {
34
34
  automated['prune'] !== true ||
35
35
  automated['selfHeal'] !== true ||
36
36
  (0, shared_1.getPath)(spec, ['syncPolicy', 'preserveResourcesOnDeletion']) === true ||
37
- !hasPrLockAsFinalValue(templateSpec)) {
37
+ !hasPreviewValuesAsFinalValue(templateSpec)) {
38
38
  throw new Error(`[nx-argo] Invalid github-pr-preview ApplicationSet policy: ${filePath}`);
39
39
  }
40
40
  }
@@ -47,8 +47,8 @@ function containsPullRequestGenerator(value) {
47
47
  ((0, shared_1.isMap)(value['pullRequest']) ||
48
48
  Object.values(value).some(containsPullRequestGenerator)));
49
49
  }
50
- /** Requires a PR-scoped final Helm values file for the optional preview policy. */
51
- function hasPrLockAsFinalValue(templateSpec) {
50
+ /** Requires the canonical preview values file as the final Helm values file. */
51
+ function hasPreviewValuesAsFinalValue(templateSpec) {
52
52
  const sources = [
53
53
  ...((0, shared_1.isMap)(templateSpec['source']) ? [templateSpec['source']] : []),
54
54
  ...(Array.isArray(templateSpec['sources'])
@@ -59,11 +59,12 @@ function hasPrLockAsFinalValue(templateSpec) {
59
59
  const valueFiles = (0, shared_1.getPath)(source, ['helm', 'valueFiles']);
60
60
  return (Array.isArray(valueFiles) &&
61
61
  typeof valueFiles.at(-1) === 'string' &&
62
- isPullRequestValuesFile(valueFiles.at(-1)));
62
+ isPreviewValuesFile(valueFiles.at(-1)));
63
63
  });
64
64
  }
65
- /** Accepts legacy lock snapshots and the flat stack values-pr contract. */
66
- function isPullRequestValuesFile(valueFile) {
67
- return valueFile.includes('/locks/pr-') || valueFile.includes('/values-pr');
65
+ /** Accepts only the canonical flat preview values contract. */
66
+ function isPreviewValuesFile(valueFile) {
67
+ return (valueFile === 'values-preview.yaml' ||
68
+ valueFile.endsWith('/values-preview.yaml'));
68
69
  }
69
70
  exports.default = runExecutor;
@@ -18,8 +18,6 @@ export interface StackValueFiles {
18
18
  production?: string;
19
19
  /** Preview base value file relative to the GitOps project. */
20
20
  preview?: string;
21
- /** Pull-request value-file pattern relative to the GitOps project. */
22
- pullRequest?: string;
23
21
  }
24
22
 
25
23
  /** Options accepted by the generic GitOps stack project generator. */
@@ -57,8 +57,7 @@
57
57
  "properties": {
58
58
  "staging": { "type": "string", "minLength": 1 },
59
59
  "production": { "type": "string", "minLength": 1 },
60
- "preview": { "type": "string", "minLength": 1 },
61
- "pullRequest": { "type": "string", "minLength": 1 }
60
+ "preview": { "type": "string", "minLength": 1 }
62
61
  },
63
62
  "additionalProperties": false
64
63
  },
@@ -7,7 +7,6 @@ const defaultValues = {
7
7
  staging: 'values-staging.yaml',
8
8
  production: 'values-production.yaml',
9
9
  preview: 'values-preview.yaml',
10
- pullRequest: 'values-pr.yaml',
11
10
  };
12
11
  /** Creates one generic GitOps project boundary for a complete Helm stack. */
13
12
  async function stackProjectGenerator(tree, options) {
@@ -118,13 +117,10 @@ function getGeneratedFiles(directory, stack, chartPath, namespacePrefix, reposit
118
117
  for (const environment of ['staging', 'production', 'preview']) {
119
118
  files[(0, devkit_1.joinPathFragments)(directory, values[environment])] = (0, yaml_1.stringify)(createValues(applications, environment), { lineWidth: 0 });
120
119
  }
121
- if (!values.pullRequest.includes('{{')) {
122
- files[(0, devkit_1.joinPathFragments)(directory, values.pullRequest)] = (0, yaml_1.stringify)(createValues(applications, 'preview'), { lineWidth: 0 });
123
- }
124
120
  let applicationSetFile;
125
121
  if (options.policy === 'github-pr-preview') {
126
122
  applicationSetFile = (0, devkit_1.joinPathFragments)(directory, 'application-set.yaml');
127
- files[applicationSetFile] = (0, yaml_1.stringify)(createApplicationSet(stack, chartPath, namespacePrefix, repository, values.pullRequest, directory, options), { lineWidth: 0 });
123
+ files[applicationSetFile] = (0, yaml_1.stringify)(createApplicationSet(stack, chartPath, namespacePrefix, repository, values.preview, directory, options), { lineWidth: 0 });
128
124
  }
129
125
  return { applicationFiles, applicationSetFile, files };
130
126
  }
@@ -169,7 +165,7 @@ function createApplication(stack, environment, chartPath, namespacePrefix, repos
169
165
  },
170
166
  };
171
167
  }
172
- /** Creates the optional generic GitHub pull-request ApplicationSet. */
168
+ /** Creates the optional GitHub pull-request ApplicationSet using preview values. */
173
169
  function createApplicationSet(stack, chartPath, namespacePrefix, repository, valuesFile, directory, options) {
174
170
  const repositoryUrl = repository.url;
175
171
  const secretName = options.githubTokenSecretName?.trim() || `argocd-github-${stack}`;