@intentius/chant-lexicon-gitlab 0.124.28 → 0.124.30
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/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "dbc7a70f16679b2f6a8dfd4fa01ceb6aec0750fcf5ba7ee41cedab3e1412cf39",
|
|
5
5
|
"meta.json": "db082fbf90c5941c498b2bee0f106103449c1a4c257716ca2220f0dd490450b2",
|
|
6
6
|
"types/index.d.ts": "a048a66ebe20da0cb5fc889054cac69044d9bf882e2c56b5c5bf113d1f3ba57c",
|
|
7
7
|
"rules/artifact-no-expiry.ts": "0ca5bb972d4a542126e8a0229d43b55658394cb7dd9b9923b2c590bec1c2ad7d",
|
|
@@ -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": "c2a6b70ffa9865bf4f758fce5851cb9c01cf1887170b0a320e6d15f74fe1c1ff"
|
|
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.124.
|
|
3
|
+
"version": "0.124.30",
|
|
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.124.
|
|
71
|
-
"@intentius/chant-lexicon-github": "^0.124.
|
|
70
|
+
"@intentius/chant": "^0.124.30",
|
|
71
|
+
"@intentius/chant-lexicon-github": "^0.124.30"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"@intentius/chant-lexicon-github": {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
workflow:
|
|
2
|
+
name: chant-pr-prod
|
|
3
|
+
rules:
|
|
4
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
5
|
+
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
6
|
+
|
|
7
|
+
stages:
|
|
8
|
+
- plan
|
|
9
|
+
- apply
|
|
10
|
+
|
|
11
|
+
variables:
|
|
12
|
+
CHANT_ENV: prod
|
|
13
|
+
GIT_DEPTH: '0'
|
|
14
|
+
|
|
15
|
+
plan:
|
|
16
|
+
stage: plan
|
|
17
|
+
image: node:22
|
|
18
|
+
rules:
|
|
19
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
20
|
+
variables:
|
|
21
|
+
BASE_SHA: '$CI_MERGE_REQUEST_DIFF_BASE_SHA'
|
|
22
|
+
PR_NUMBER: '$CI_MERGE_REQUEST_IID'
|
|
23
|
+
script:
|
|
24
|
+
- command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
|
|
25
|
+
- chant build --env prod
|
|
26
|
+
- chant lint
|
|
27
|
+
- chant components pr-plan --base "$BASE_SHA" --pr "$PR_NUMBER" --env prod --gate pr-apply --output .chant/pr --forge gitlab
|
|
28
|
+
artifacts:
|
|
29
|
+
when: always
|
|
30
|
+
paths:
|
|
31
|
+
- .chant/pr
|
|
32
|
+
|
|
33
|
+
apply:
|
|
34
|
+
stage: apply
|
|
35
|
+
image: node:22
|
|
36
|
+
resource_group: chant-apply-prod
|
|
37
|
+
rules:
|
|
38
|
+
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
39
|
+
variables:
|
|
40
|
+
BASE_SHA: '$CI_COMMIT_BEFORE_SHA'
|
|
41
|
+
script:
|
|
42
|
+
- command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
|
|
43
|
+
- if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then BASE_SHA="${CI_MERGE_REQUEST_DIFF_BASE_SHA:-}"; if [ -z "$BASE_SHA" ]; then git fetch origin $CI_DEFAULT_BRANCH && BASE_SHA="$(git merge-base FETCH_HEAD "$CI_COMMIT_SHA")"; if [ "$BASE_SHA" = "$CI_COMMIT_SHA" ]; then BASE_SHA="$(git rev-parse "$CI_COMMIT_SHA^")"; fi; fi; fi; export BASE_SHA
|
|
44
|
+
- chant build --env prod
|
|
45
|
+
- chant lint
|
|
46
|
+
- chant components pr-apply --base "$BASE_SHA" --env prod --gate pr-apply --output .chant/pr --forge gitlab --require-review --resume .chant/pr-resume/pr-apply.json
|
|
47
|
+
cache:
|
|
48
|
+
key: chant-apply-prod-$CI_COMMIT_SHA
|
|
49
|
+
paths:
|
|
50
|
+
- .chant/pr-resume/pr-apply.json
|
|
51
|
+
when: always
|
|
52
|
+
artifacts:
|
|
53
|
+
when: always
|
|
54
|
+
paths:
|
|
55
|
+
- .chant/pr
|
|
@@ -302,7 +302,7 @@ function prLoopGitlabPipeline(
|
|
|
302
302
|
const onMerge = gitlabPushRule(loop.branch ? JSON.stringify(loop.branch) : "$CI_DEFAULT_BRANCH");
|
|
303
303
|
// A member's jobs start in its directory, after the image's install lines.
|
|
304
304
|
const enter = rooted ? [] : [`cd ${memberShellDir(member!)}`];
|
|
305
|
-
const script = (job: typeof plan): string[] => [...prLoopSetup(image), ...enter, ...beforeScript, ...(job.setup ?? []), job.command, ...extraScript];
|
|
305
|
+
const script = (job: typeof plan): string[] => [...prLoopSetup(image), ...enter, ...beforeScript, ...(job.setup ?? []), ...(job.build ?? []), job.command, ...extraScript];
|
|
306
306
|
const stages = ["plan", "apply"];
|
|
307
307
|
const doc: Record<string, unknown> = {
|
|
308
308
|
// Included files merge their top-level keys, so a member's file carries
|
|
@@ -63,6 +63,16 @@ describe("the GitLab merge-request pipeline", () => {
|
|
|
63
63
|
expect(doc.apply.artifacts).toEqual({ when: "always", paths: [".chant/pr"] });
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
test("events and reportUrl stream the run's events into the report artifact and copy the reports out (#4007)", () => {
|
|
67
|
+
const loud = parseYAML(generateGitlabPipeline(ESTATE, { env: "prod", prLoop: { events: true, reportUrl: "$CHANT_REPORT_URL" } }).yaml) as { plan: Job; apply: Job };
|
|
68
|
+
for (const job of [loud.plan, loud.apply]) {
|
|
69
|
+
expect(job.script.at(-1)).toContain('--events-json --report-url "$CHANT_REPORT_URL"');
|
|
70
|
+
expect(job.variables.CHANT_RUN_EVENTS_DIR).toBe(".chant/pr/run-events");
|
|
71
|
+
expect(job.artifacts).toEqual({ when: "always", paths: [".chant/pr"] });
|
|
72
|
+
}
|
|
73
|
+
expect(result.yaml).not.toContain("--events-json");
|
|
74
|
+
});
|
|
75
|
+
|
|
66
76
|
test("runs in an image with git and installs OpenTofu, unless the caller names an image", () => {
|
|
67
77
|
expect(doc.plan.image).toBe("node:22");
|
|
68
78
|
expect(doc.apply.script[0]).toBe(PR_LOOP_SETUP[0]);
|
|
@@ -125,3 +135,35 @@ describe("the merge-request pipeline's branch (#3765)", () => {
|
|
|
125
135
|
expect(() => generateGitlabPipeline(ESTATE, { env: "prod", prLoop: { branch: "re$lease" } })).toThrow(/filters on branch "re\$lease"/);
|
|
126
136
|
});
|
|
127
137
|
});
|
|
138
|
+
|
|
139
|
+
describe("the gitlab pull-request pipeline with build (#4088)", () => {
|
|
140
|
+
const result = generateGitlabPipeline(ESTATE, { env: "prod", prLoop: { build: true } });
|
|
141
|
+
const doc = parseYAML(result.yaml) as Record<string, any>;
|
|
142
|
+
const golden = join(import.meta.dirname, "__fixtures__", "pr-loop-build.gitlab.golden.yml");
|
|
143
|
+
|
|
144
|
+
test("matches its golden", () => {
|
|
145
|
+
if (process.env.UPDATE_GOLDEN) writeFileSync(golden, result.yaml);
|
|
146
|
+
expect(result.yaml).toBe(readFileSync(golden, "utf-8"));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("builds, then lints, before pr-plan and pr-apply", () => {
|
|
150
|
+
const script = (job: string) => (doc[job] as { script: string[] }).script;
|
|
151
|
+
for (const job of ["plan", "apply"]) {
|
|
152
|
+
const lines = script(job);
|
|
153
|
+
const i = lines.findIndex((l) => l.startsWith("chant components pr-"));
|
|
154
|
+
expect(lines.slice(i - 2, i)).toEqual(["chant build --env prod", "chant lint"]);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("buildCommand replaces the build line and turns the option on", () => {
|
|
159
|
+
const yaml = generateGitlabPipeline(ESTATE, { env: "prod", prLoop: { buildCommand: "npm run build" } }).yaml;
|
|
160
|
+
expect(yaml).toContain("npm run build");
|
|
161
|
+
expect(yaml).not.toContain("chant build --env");
|
|
162
|
+
expect(yaml).toContain("chant lint");
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("the default output carries neither line", () => {
|
|
166
|
+
const plain = generateGitlabPipeline(ESTATE, { env: "prod", prLoop: {} }).yaml;
|
|
167
|
+
expect(plain).not.toContain("chant lint");
|
|
168
|
+
});
|
|
169
|
+
});
|