@intentius/chant-lexicon-github 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/components/generate-pipeline.d.ts.map +1 -1
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/package.json +2 -2
- package/src/components/__fixtures__/pr-loop-build.github.golden.yml +90 -0
- package/src/components/generate-pipeline.ts +1 -0
- package/src/components/generate-pr-pipeline.test.ts +43 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAMjG,OAAO,KAAK,EACV,oBAAoB,IAAI,YAAY,EACpC,wBAAwB,IAAI,qBAAqB,EACjD,uBAAuB,IAAI,oBAAoB,EAEhD,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,mIAAmI;IACnI,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,uEAAuE;IACvE,MAAM,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AAO,GAAE,qBAA0B,GAClC,iBAAiB,CA+JnB;AA4CD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CAGtB"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "702527bc372f64e7746debfbbe6770c801dd4642f985940ae00027da6950ee3f",
|
|
5
5
|
"meta.json": "c50e0ef3845c370c3ad2210b8bba455980417c0f818aa6ed46e06d4fb8b1b9f9",
|
|
6
6
|
"types/index.d.ts": "0ead95536e947ddfb98a5acf0ddb88547913b5a53a342df67711c59266f84b3e",
|
|
7
7
|
"rules/deprecated-action-version.ts": "a9ba7cc924ff1c7055110416d8989273690415bfb5e8dcc32dc9431b9351f5ca",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"skills/chant-github-patterns.md": "bb3abef289a8fdfcf07d6bb2d7289dcb2f38bc0cb0321ea320b78b45a6f548c0",
|
|
79
79
|
"skills/chant-github-security.md": "aab111cb0871cad30281ce48d7da23663689619351029219e2be019a1a61e394"
|
|
80
80
|
},
|
|
81
|
-
"composite": "
|
|
81
|
+
"composite": "b917acd9f2419781010d3a1cfc3d2bbd9bc8b9bcccfc6b3cfdff324d1dda48db"
|
|
82
82
|
}
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-github",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.30",
|
|
4
4
|
"description": "GitHub Actions lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"typescript": "^5.9.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@intentius/chant": "^0.124.
|
|
64
|
+
"@intentius/chant": "^0.124.30"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: chant-pr-prod
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
CHANT_ENV: prod
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
plan:
|
|
16
|
+
if: github.event_name == 'pull_request'
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
container: node:22
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
pull-requests: write
|
|
22
|
+
statuses: write
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v7
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
- run: 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)
|
|
28
|
+
- name: Build the templates
|
|
29
|
+
run: chant build --env prod
|
|
30
|
+
- name: Lint the project
|
|
31
|
+
run: chant lint
|
|
32
|
+
- name: Plan the members this pull request reaches
|
|
33
|
+
env:
|
|
34
|
+
BASE_SHA: '${{ github.event.pull_request.base.sha }}'
|
|
35
|
+
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
|
36
|
+
GITHUB_TOKEN: '${{ github.token }}'
|
|
37
|
+
run: chant components pr-plan --base "$BASE_SHA" --pr "$PR_NUMBER" --env prod --gate pr-apply --output .chant/pr --forge github
|
|
38
|
+
- name: Keep the plan report
|
|
39
|
+
if: always()
|
|
40
|
+
uses: actions/upload-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: chant-pr-plan
|
|
43
|
+
path: .chant/pr
|
|
44
|
+
if-no-files-found: ignore
|
|
45
|
+
include-hidden-files: true
|
|
46
|
+
apply:
|
|
47
|
+
if: github.event_name == 'push'
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
container: node:22
|
|
50
|
+
concurrency:
|
|
51
|
+
group: chant-apply-prod
|
|
52
|
+
cancel-in-progress: false
|
|
53
|
+
permissions:
|
|
54
|
+
contents: write
|
|
55
|
+
pull-requests: write
|
|
56
|
+
statuses: write
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v7
|
|
59
|
+
with:
|
|
60
|
+
fetch-depth: 0
|
|
61
|
+
- run: 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)
|
|
62
|
+
- name: Build the templates
|
|
63
|
+
run: chant build --env prod
|
|
64
|
+
- name: Lint the project
|
|
65
|
+
run: chant lint
|
|
66
|
+
- name: Restore the record of an earlier attempt at this commit
|
|
67
|
+
uses: actions/cache/restore@v4
|
|
68
|
+
with:
|
|
69
|
+
path: .chant/pr-resume/pr-apply.json
|
|
70
|
+
key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
71
|
+
restore-keys: chant-apply-prod-${{ github.sha }}-
|
|
72
|
+
- name: Apply the plan a reviewer approved
|
|
73
|
+
env:
|
|
74
|
+
BASE_SHA: '${{ github.event.before }}'
|
|
75
|
+
GITHUB_TOKEN: '${{ github.token }}'
|
|
76
|
+
run: chant components pr-apply --base "$BASE_SHA" --env prod --gate pr-apply --output .chant/pr --forge github --require-review --resume .chant/pr-resume/pr-apply.json
|
|
77
|
+
- name: Keep the record for a re-run
|
|
78
|
+
if: always()
|
|
79
|
+
uses: actions/cache/save@v4
|
|
80
|
+
with:
|
|
81
|
+
path: .chant/pr-resume/pr-apply.json
|
|
82
|
+
key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
|
|
83
|
+
- name: Keep the apply report
|
|
84
|
+
if: always()
|
|
85
|
+
uses: actions/upload-artifact@v4
|
|
86
|
+
with:
|
|
87
|
+
name: chant-pr-apply
|
|
88
|
+
path: .chant/pr
|
|
89
|
+
if-no-files-found: ignore
|
|
90
|
+
include-hidden-files: true
|
|
@@ -210,6 +210,7 @@ function prLoopGithubDoc(
|
|
|
210
210
|
checkoutStep(true),
|
|
211
211
|
...runSteps(prLoopSetup(image)),
|
|
212
212
|
...runSteps(beforeScript),
|
|
213
|
+
...(job.build ? [{ name: "Build the templates", run: job.build[0] }, { name: "Lint the project", run: job.build[1] }] : []),
|
|
213
214
|
...(job.jobName === "apply" ? [restoreRecord] : []),
|
|
214
215
|
{ name, env: job.env, run: job.command },
|
|
215
216
|
...runSteps(extraScript),
|
|
@@ -117,6 +117,18 @@ describe("the GitHub pull-request workflow", () => {
|
|
|
117
117
|
expect(() => generateGithubPipeline(ESTATE, { prLoop: {}, promoteTo: "prod" })).toThrow(/pull-request pipeline has no wave or promote jobs/);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
test("events and reportUrl stream the run's events into the report artifact and copy the reports out (#4007)", () => {
|
|
121
|
+
const loud = parseYAML(generateGithubPipeline(ESTATE, { env: "prod", prLoop: { events: true, reportUrl: "s3://chant-reports/acme" } }).yaml) as { jobs: Record<string, Job> };
|
|
122
|
+
for (const job of ["plan", "apply"]) {
|
|
123
|
+
const run = loud.jobs[job].steps.find((s) => s.run?.startsWith("chant components"))!;
|
|
124
|
+
expect(run.run).toContain('--events-json --report-url "s3://chant-reports/acme"');
|
|
125
|
+
expect(run.env?.CHANT_RUN_EVENTS_DIR).toBe(".chant/pr/run-events");
|
|
126
|
+
}
|
|
127
|
+
// Off by default: the golden carries neither.
|
|
128
|
+
expect(result.yaml).not.toContain("--events-json");
|
|
129
|
+
expect(result.yaml).not.toContain("CHANT_RUN_EVENTS_DIR");
|
|
130
|
+
});
|
|
131
|
+
|
|
120
132
|
test("inside a workspace member: runs in the member's directory and keeps its own gate, note and apply group (#3465)", () => {
|
|
121
133
|
const member = { name: "network", dir: "infra/network", file: ".github/workflows/chant-pr.network.prod.yml" };
|
|
122
134
|
const scoped = generateGithubPipeline(ESTATE, { env: "prod", prLoop: {}, member });
|
|
@@ -175,3 +187,34 @@ describe("the GitHub pull-request workflow", () => {
|
|
|
175
187
|
}
|
|
176
188
|
});
|
|
177
189
|
});
|
|
190
|
+
|
|
191
|
+
describe("the github pull-request pipeline with build (#4088)", () => {
|
|
192
|
+
const result = generateGithubPipeline(ESTATE, { env: "prod", prLoop: { build: true } });
|
|
193
|
+
const doc = parseYAML(result.yaml) as Record<string, any>;
|
|
194
|
+
const golden = join(import.meta.dirname, "__fixtures__", "pr-loop-build.github.golden.yml");
|
|
195
|
+
|
|
196
|
+
test("matches its golden", () => {
|
|
197
|
+
if (process.env.UPDATE_GOLDEN) writeFileSync(golden, result.yaml);
|
|
198
|
+
expect(result.yaml).toBe(readFileSync(golden, "utf-8"));
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test("builds, then lints, before pr-plan and pr-apply", () => {
|
|
202
|
+
for (const job of ["plan", "apply"]) {
|
|
203
|
+
const runs = doc.jobs[job].steps.map((s: { run?: string }) => s.run ?? "").filter(Boolean);
|
|
204
|
+
const i = runs.findIndex((r: string) => r.startsWith("chant components pr-"));
|
|
205
|
+
expect(runs.slice(i - 2, i)).toEqual(["chant build --env prod", "chant lint"]);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test("buildCommand replaces the build line and turns the option on", () => {
|
|
210
|
+
const yaml = generateGithubPipeline(ESTATE, { env: "prod", prLoop: { buildCommand: "npm run build" } }).yaml;
|
|
211
|
+
expect(yaml).toContain("npm run build");
|
|
212
|
+
expect(yaml).not.toContain("chant build --env");
|
|
213
|
+
expect(yaml).toContain("chant lint");
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("the default output carries neither line", () => {
|
|
217
|
+
const plain = generateGithubPipeline(ESTATE, { env: "prod", prLoop: {} }).yaml;
|
|
218
|
+
expect(plain).not.toContain("chant lint");
|
|
219
|
+
});
|
|
220
|
+
});
|