@intentius/chant-lexicon-gitlab 0.117.0 → 0.118.1
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/dist/components/generate-op-waves-pipeline.d.ts +3 -0
- package/dist/components/generate-op-waves-pipeline.d.ts.map +1 -1
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/package.json +3 -3
- package/src/components/generate-op-waves-pipeline.test.ts +8 -0
- package/src/components/generate-op-waves-pipeline.ts +19 -2
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* with the spec's cron. It retries a waiting wave's job once its approval
|
|
16
16
|
* arrived, with `CHANT_FORGE_TOKEN` (a project access token with the `api`
|
|
17
17
|
* scope and the Developer role; the job token cannot retry jobs).
|
|
18
|
+
*
|
|
19
|
+
* A `pr-review` wave (#3684) adds `<name>-record-plans`, run in merge request
|
|
20
|
+
* pipelines only, which records the digests the merge request's head plans.
|
|
18
21
|
*/
|
|
19
22
|
import { type OpWavesSpec } from "@intentius/chant/op/op-waves";
|
|
20
23
|
import type { OpWavesPipelineOptions, OpWavesPipelineResult } from "@intentius/chant/lexicon";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-op-waves-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-op-waves-pipeline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate-op-waves-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-op-waves-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAoC,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAK9F,gHAAgH;AAChH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CA4EvH"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "c1fbb032e4112bba50f38ddd107b2ca78b519d501211549172134e14c6ff84c3",
|
|
5
5
|
"meta.json": "931fc3246a55645b1493080bbeb160e5d205e42349e8bdca96ca243adb5f0da3",
|
|
6
6
|
"types/index.d.ts": "5cd2e99f135a929b72bdd822d00d780d39b1cd407ba0cfb3d511c7ac9d667b58",
|
|
7
7
|
"rules/artifact-no-expiry.ts": "3f3cabf9792cbf8207e53a25f506715466b19ec25e9c3b4d0d77fed6b2eb4542",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"skills/chant-gitlab-migrate.md": "4853d04980560b379e5b0f7267dcb0a1e5d5879cb9e9931681ce76b2a5fe69d8",
|
|
56
56
|
"skills/chant-gitlab-patterns.md": "6d9a44e9e8de4c3820be9d65381b0d2ede4cb3626aaaf0011e21838a9fbf556e"
|
|
57
57
|
},
|
|
58
|
-
"composite": "
|
|
58
|
+
"composite": "d8b0f5de08f945bf3f79d1a76f351def325dae22ddf841d36dd3efbebdafa08a"
|
|
59
59
|
}
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-gitlab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.118.1",
|
|
4
4
|
"description": "GitLab CI lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"typescript": "^5.9.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@intentius/chant": "^0.
|
|
71
|
-
"@intentius/chant-lexicon-github": "^0.
|
|
70
|
+
"@intentius/chant": "^0.118.1",
|
|
71
|
+
"@intentius/chant-lexicon-github": "^0.118.1",
|
|
72
72
|
"typescript": "^5.9.3"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
@@ -36,4 +36,12 @@ describe("generateGitlabOpWavesPipeline", () => {
|
|
|
36
36
|
expect(yaml).toContain('give the schedule the cron "*/10 * * * *"');
|
|
37
37
|
expect(generateGitlabOpWavesPipeline(spec, { specFile: "waves.json" }).files[0]!.yaml).not.toContain("resume");
|
|
38
38
|
});
|
|
39
|
+
|
|
40
|
+
test("a pr-review wave adds a merge request job that records the head's plans (#3684)", () => {
|
|
41
|
+
const yaml = generateGitlabOpWavesPipeline({ ...spec, waves: spec.waves.map((w, i) => (i === spec.waves.length - 1 ? { ...w, approval: "pr-review" as const } : w)) }, { specFile: "waves.json" }).files[0]!.yaml;
|
|
42
|
+
expect(yaml).toContain(`${spec.name}-record-plans:`);
|
|
43
|
+
expect(yaml).toContain('$CI_PIPELINE_SOURCE == "merge_request_event"');
|
|
44
|
+
expect(yaml).toContain("chant run wave --spec waves.json --record-plans");
|
|
45
|
+
expect(yaml).toMatch(/stages:\n\s+- plans\n/);
|
|
46
|
+
});
|
|
39
47
|
});
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* with the spec's cron. It retries a waiting wave's job once its approval
|
|
16
16
|
* arrived, with `CHANT_FORGE_TOKEN` (a project access token with the `api`
|
|
17
17
|
* scope and the Developer role; the job token cannot retry jobs).
|
|
18
|
+
*
|
|
19
|
+
* A `pr-review` wave (#3684) adds `<name>-record-plans`, run in merge request
|
|
20
|
+
* pipelines only, which records the digests the merge request's head plans.
|
|
18
21
|
*/
|
|
19
22
|
|
|
20
23
|
import { emitYAMLEntry } from "@intentius/chant/yaml";
|
|
@@ -36,7 +39,8 @@ export function generateGitlabOpWavesPipeline(spec: OpWavesSpec, options: OpWave
|
|
|
36
39
|
}
|
|
37
40
|
const rules = branches.map((branch) => ({ if: `$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "${branch}"` }));
|
|
38
41
|
|
|
39
|
-
const
|
|
42
|
+
const byReview = spec.waves.some((w) => w.approval === "pr-review");
|
|
43
|
+
const stages = [...(byReview ? ["plans"] : []), ...spec.waves.map((wave, i) => `wave-${i + 1}-${wave.name}`)];
|
|
40
44
|
if (spec.resume) stages.push("resume");
|
|
41
45
|
const sections: string[] = [emitYAMLEntry("stages", stages)];
|
|
42
46
|
if (options.variables && Object.keys(options.variables).length > 0) sections.push(emitYAMLEntry("variables", options.variables));
|
|
@@ -53,7 +57,7 @@ export function generateGitlabOpWavesPipeline(spec: OpWavesSpec, options: OpWave
|
|
|
53
57
|
});
|
|
54
58
|
sections.push(
|
|
55
59
|
emitYAMLEntry(job.jobName, {
|
|
56
|
-
stage: stages[job.wave - 1],
|
|
60
|
+
stage: stages[job.wave - 1 + (byReview ? 1 : 0)],
|
|
57
61
|
image,
|
|
58
62
|
resource_group: `${spec.name}-${wave.name}`,
|
|
59
63
|
...(wave.environment
|
|
@@ -77,6 +81,19 @@ export function generateGitlabOpWavesPipeline(spec: OpWavesSpec, options: OpWave
|
|
|
77
81
|
}),
|
|
78
82
|
);
|
|
79
83
|
}
|
|
84
|
+
if (byReview) {
|
|
85
|
+
sections.splice(
|
|
86
|
+
options.variables && Object.keys(options.variables).length > 0 ? 2 : 1,
|
|
87
|
+
0,
|
|
88
|
+
emitYAMLEntry(`${spec.name}-record-plans`, {
|
|
89
|
+
stage: "plans",
|
|
90
|
+
image,
|
|
91
|
+
variables: { GIT_DEPTH: "0" },
|
|
92
|
+
rules: [{ if: '$CI_PIPELINE_SOURCE == "merge_request_event"' }],
|
|
93
|
+
script: [...(options.beforeScript ?? []), ["chant", "run", "wave", "--spec", options.specFile, "--record-plans"].join(" ")],
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
}
|
|
80
97
|
const header = [
|
|
81
98
|
`# chant Op waves "${spec.name}" (#3679): one stage per wave, each needing the one before.`,
|
|
82
99
|
"# A wave that waits at its gate exits 3 and stops the waves after it; approve the",
|