@intentius/chant 0.124.88 → 0.124.89
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/actor.d.ts +36 -1
- package/dist/actor.d.ts.map +1 -1
- package/dist/actor.js +39 -1
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +1 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-evidence-from-job.d.ts +25 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -1
- package/dist/ci-evidence-from-job.js +43 -2
- package/dist/ci-evidence-jobs.d.ts +30 -1
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +46 -3
- package/dist/ci-image.d.ts +21 -4
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +62 -10
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +42 -0
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +25 -0
- package/dist/ci-product.d.ts +31 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +34 -4
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/ci-check.d.ts +1 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +17 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +33 -7
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +3 -1
- package/dist/cli/handlers/generated-check.d.ts +8 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -1
- package/dist/cli/handlers/generated-check.js +31 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +55 -9
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +2 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +11 -2
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +28 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +24 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +16 -0
- package/dist/cli/registry.d.ts +11 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/pr-checks.d.ts +70 -6
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +74 -13
- package/dist/components/pr-pipeline.d.ts +16 -12
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +3 -11
- package/dist/components/product-pipeline.d.ts +42 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +64 -12
- package/dist/components/product-plan.d.ts +190 -5
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +220 -39
- package/dist/drift-record.d.ts +7 -0
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +19 -0
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +54 -31
- package/dist/forge-check/contract.d.ts +11 -1
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +4 -1
- package/dist/forge-check/index.d.ts +2 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +2 -0
- package/dist/gate-resume-run.d.ts +9 -1
- package/dist/gate-resume-run.d.ts.map +1 -1
- package/dist/gate-resume-run.js +26 -3
- package/dist/generated-check.d.ts +18 -4
- package/dist/generated-check.d.ts.map +1 -1
- package/dist/generated-check.js +37 -5
- package/dist/image-pins.d.ts +26 -0
- package/dist/image-pins.d.ts.map +1 -0
- package/dist/image-pins.js +19 -0
- package/dist/lexicon.d.ts +11 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +11 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +27 -1
- package/dist/lifecycle/reach-locks.d.ts +131 -0
- package/dist/lifecycle/reach-locks.d.ts.map +1 -0
- package/dist/lifecycle/reach-locks.js +118 -0
- package/dist/lifecycle/release-cut.d.ts +3 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +1 -2
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +6 -1
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +9 -3
- package/dist/op/op-waves-render-spec.d.ts +100 -0
- package/dist/op/op-waves-render-spec.d.ts.map +1 -0
- package/dist/op/op-waves-render-spec.js +162 -0
- package/dist/op/op-waves-run.d.ts +2 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +2 -1
- package/dist/op/op-waves.d.ts +4 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +4 -1
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +59 -3
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-loop.d.ts +3 -6
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -81
- package/dist/pr-plan-note.d.ts +97 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +94 -1
- package/dist/pr-post.d.ts +28 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +145 -13
- package/dist/pr-status.d.ts +16 -0
- package/dist/pr-status.d.ts.map +1 -0
- package/dist/pr-status.js +90 -0
- package/dist/ref-gate-init.d.ts +16 -2
- package/dist/ref-gate-init.d.ts.map +1 -1
- package/dist/ref-gate-init.js +24 -13
- package/dist/release-floors.d.ts +37 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +61 -25
- package/dist/render-module.d.ts +15 -0
- package/dist/render-module.d.ts.map +1 -0
- package/dist/render-module.js +73 -0
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +1 -2
- package/dist/wave-runtime.mjs +304 -301
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +3 -2
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +2 -1
- package/dist/workspace/release-workflow.d.ts +4 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +10 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +15 -8
- package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +30 -10
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +1 -1
- package/src/actor.test.ts +68 -2
- package/src/actor.ts +61 -1
- package/src/chant-install.test.ts +2 -3
- package/src/chant-install.ts +1 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +2 -3
- package/src/ci-evidence-from-job.test.ts +18 -0
- package/src/ci-evidence-from-job.ts +58 -2
- package/src/ci-evidence-jobs.ts +50 -5
- package/src/ci-image.test.ts +130 -9
- package/src/ci-image.ts +85 -12
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +59 -0
- package/src/ci-product.ts +40 -4
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/ci-check.ts +19 -7
- package/src/cli/handlers/ci-evidence.ts +29 -8
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +31 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +50 -10
- package/src/cli/handlers/promote.ts +2 -1
- package/src/cli/handlers/release.e2e.test.ts +35 -0
- package/src/cli/handlers/release.ts +14 -2
- package/src/cli/handlers/run-wave.ts +28 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +24 -2
- package/src/cli/parse-args.ts +12 -0
- package/src/cli/registry.ts +11 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/pr-checks.ts +112 -17
- package/src/components/pr-pipeline.ts +17 -15
- package/src/components/product-pipeline.ts +93 -11
- package/src/components/product-plan.test.ts +40 -2
- package/src/components/product-plan.ts +331 -45
- package/src/drift-record.test.ts +20 -0
- package/src/drift-record.ts +16 -0
- package/src/floor-table.data.ts +54 -31
- package/src/forge-check/contract.ts +12 -1
- package/src/forge-check/forge-check.test.ts +17 -0
- package/src/forge-check/index.ts +2 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +21 -1
- package/src/generated-check.test.ts +66 -0
- package/src/generated-check.ts +51 -10
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +11 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +31 -1
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images.test.ts +56 -0
- package/src/lifecycle/release-images.ts +1 -2
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +10 -4
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +2 -1
- package/src/op/op-waves.ts +5 -2
- package/src/op/schedule-overdue.test.ts +43 -0
- package/src/op/schedule-overdue.ts +57 -3
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-loop-narrowed.test.ts +2 -1
- package/src/pr-loop-words.test.ts +2 -1
- package/src/pr-loop.test.ts +1 -2
- package/src/pr-loop.ts +4 -80
- package/src/pr-plan-note.ts +155 -3
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +2 -1
- package/src/pr-post.ts +150 -15
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +30 -11
- package/src/release-floors.ts +78 -25
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +2 -3
- package/src/state-migration.ts +1 -2
- package/src/workspace/ci-green-cli.ts +3 -2
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +36 -5
- package/src/workspace/release-workflow.ts +10 -7
- package/src/workspace/trust/check-evidence-report.ts +15 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/ref-gate-cli.ts +30 -8
- package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/workspace-run.ts +2 -1
package/dist/ci-evidence-jobs.js
CHANGED
|
@@ -47,7 +47,7 @@ export const EVIDENCE_IDENTITY_ENV = "CHANT_RUNNER_IDENTITY";
|
|
|
47
47
|
export const EVIDENCE_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
|
|
48
48
|
/** The audience a keyless signing job's token is requested for unless told: sigstore's. */
|
|
49
49
|
export const EVIDENCE_DEFAULT_AUDIENCE = "sigstore";
|
|
50
|
-
export { CHECK_EVIDENCE_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, KEYLESS_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR, WAVE_EVIDENCE_JOB_FLOOR } from "./release-floors.js";
|
|
50
|
+
export { CHECK_EVIDENCE_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, GITLAB_WAVE_EVIDENCE_RETRY_FLOOR, GITLAB_WAVE_KEY_SCOPE_FLOOR, KEYLESS_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR, MEMBER_SIGNED_CHECKS_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR, TARGET_SIGNED_CHECKS_FLOOR, WAVE_EVIDENCE_JOB_FLOOR } from "./release-floors.js";
|
|
51
51
|
/**
|
|
52
52
|
* The GitLab environment every signing job names (#4914), with `action:
|
|
53
53
|
* access`, so it creates no deployment. Scope the runner key's CI/CD
|
|
@@ -71,7 +71,50 @@ export function gitlabOpenEvidenceDir(job) {
|
|
|
71
71
|
*/
|
|
72
72
|
export function openEvidenceLines(opts) {
|
|
73
73
|
const chant = opts.bin ?? "chant";
|
|
74
|
-
return [`${chant} ci evidence sign --open --job ${opts.job} --from-report ${opts.dir} --base "$CI_COMMIT_SHA" --output ${opts.out}${opts.noForks ? " --no-forks" : ""}`];
|
|
74
|
+
return [`${chant} ci evidence sign --open --job ${opts.job} --from-report ${opts.dir}${memberFlag(opts.member)} --base "$CI_COMMIT_SHA" --output ${opts.out}${opts.noForks ? " --no-forks" : ""}`];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The check a workspace member's pipeline signs for one of the plan job's
|
|
78
|
+
* two (#4964): `plan:<member>`, `policy:<member>`. A member's plan job plans
|
|
79
|
+
* that member alone, so its pass says nothing of another member's plan; a
|
|
80
|
+
* `refs` rule names each member's checks. The root pipeline's are `plan`
|
|
81
|
+
* and `policy`.
|
|
82
|
+
*/
|
|
83
|
+
export function memberEvidenceCheck(check, member) {
|
|
84
|
+
return member ? `${check}:${member}` : check;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The check a product plan target's note job signs for one of its plan
|
|
88
|
+
* job's two (#4978): `plan:<target>`, `policy:<target>`. Each target has a
|
|
89
|
+
* plan job of its own, so its pass says nothing of another target's plan,
|
|
90
|
+
* and a `refs` rule names each target's checks. A product plan without
|
|
91
|
+
* targets signs `plan` and `policy`.
|
|
92
|
+
*/
|
|
93
|
+
export function targetEvidenceCheck(check, target) {
|
|
94
|
+
return memberEvidenceCheck(check, target);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The checks a product plan's note jobs sign (#4978), in the order a `refs`
|
|
98
|
+
* rule lists them: `plan` and `policy`, or with `targets` each target's
|
|
99
|
+
* `plan:<target>` and `policy:<target>`.
|
|
100
|
+
*/
|
|
101
|
+
export function productPlanEvidenceChecks(targets) {
|
|
102
|
+
if (!targets || targets.length === 0)
|
|
103
|
+
return ["plan", "policy"];
|
|
104
|
+
return targets.flatMap((t) => [targetEvidenceCheck("plan", t), targetEvidenceCheck("policy", t)]);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The name `--member` takes (#4964): a workspace member's or (#4978) a
|
|
108
|
+
* product plan target's, which a check name carries after `plan:`.
|
|
109
|
+
*/
|
|
110
|
+
export const EVIDENCE_MEMBER_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
111
|
+
/** ` --member <name>` on a signing line of a member's or a target's plan evidence (#4964, #4978), or nothing. */
|
|
112
|
+
function memberFlag(member) {
|
|
113
|
+
if (member === undefined)
|
|
114
|
+
return "";
|
|
115
|
+
if (!EVIDENCE_MEMBER_NAME.test(member))
|
|
116
|
+
throw new Error(`the name ${JSON.stringify(member)} is not one a check name can carry: letters, digits, - and _`);
|
|
117
|
+
return ` --member ${member}`;
|
|
75
118
|
}
|
|
76
119
|
const SECRET_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
77
120
|
/** Refuse a secret name the forge could not hold, and an evidence block that names both identities or neither. */
|
|
@@ -114,6 +157,6 @@ export function planEvidenceLines(opts) {
|
|
|
114
157
|
const chant = opts.bin ?? "chant";
|
|
115
158
|
return [
|
|
116
159
|
`git fetch --quiet --no-tags --depth=1 origin ${opts.at} || true`,
|
|
117
|
-
`${chant} ci evidence sign --from-report ${opts.dir} --result ${opts.result} --at ${opts.at} --base ${opts.base}`,
|
|
160
|
+
`${chant} ci evidence sign --from-report ${opts.dir}${memberFlag(opts.member)} --result ${opts.result} --at ${opts.at} --base ${opts.base}`,
|
|
118
161
|
];
|
|
119
162
|
}
|
package/dist/ci-image.d.ts
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* checks it, for an image's fetch stage; {@link ciToolInstallLine} is the
|
|
19
19
|
* job line that runs it unless the binary is there (with `sudo`, or under
|
|
20
20
|
* a root such as `$RUNNER_TEMP/chant-tools`, for a job that is not root,
|
|
21
|
-
* #4908)
|
|
21
|
+
* #4908). With `download: "node"` both fetch and unpack with node, for
|
|
22
|
+
* an image with no curl or unzip (#4952). {@link installCiTool} does the same from Node, for a product
|
|
22
23
|
* that installs a pinned release at run time.
|
|
23
24
|
* - {@link productImageStages} is a product's image as stages a Dockerfile
|
|
24
25
|
* takes (the docker lexicon's `new Dockerfile({ stages })`), and
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
* project publishes a checksums file is checked against that file's line
|
|
32
33
|
* for the archive, and against the recorded sha256 when there is one, so a
|
|
33
34
|
* tampered checksums file fails as a tampered archive does. A release with
|
|
34
|
-
* no checksums file (the AWS CLI, just
|
|
35
|
+
* no checksums file (the AWS CLI, just before 1.35.0) needs a recorded sha256. An
|
|
35
36
|
* image always needs a recorded sha256 for both architectures, and a caller
|
|
36
37
|
* passes `requirePin` to ask the same of a job line or a run-time install.
|
|
37
38
|
*
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
* chant's release floors, so a product can bundle it or import it from a
|
|
40
41
|
* plain Node script.
|
|
41
42
|
*/
|
|
42
|
-
import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR } from "./release-floors.js";
|
|
43
|
-
export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR };
|
|
43
|
+
import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR } from "./release-floors.js";
|
|
44
|
+
export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR };
|
|
44
45
|
export type CiTool = "tofu" | "terraform" | "terragrunt" | "choudoufu" | "infracost" | "cosign" | "atmos" | "terramate" | "pulumi" | "plunge" | "aws-cli" | "just" | "act";
|
|
45
46
|
/** The architectures chant fetches, as Docker's `TARGETARCH` names them. */
|
|
46
47
|
export type CiToolArch = "amd64" | "arm64";
|
|
@@ -100,6 +101,14 @@ export interface CiToolCheckOptions {
|
|
|
100
101
|
/** Refuse a release with no recorded sha256 for an architecture, rather than trust its checksums file alone. Default false. */
|
|
101
102
|
requirePin?: boolean;
|
|
102
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* How a fetch line downloads and unpacks a release (#4952): `curl` (the
|
|
106
|
+
* default) with `unzip` for a zip, or `node`, which downloads with node's
|
|
107
|
+
* `fetch` and unpacks a zip with node, for a job whose image carries node
|
|
108
|
+
* but neither curl nor unzip. The check is the same either way; tar,
|
|
109
|
+
* sha256sum and sed are still the image's.
|
|
110
|
+
*/
|
|
111
|
+
export type CiToolDownload = "curl" | "node";
|
|
103
112
|
export interface CiToolFetchOptions extends CiToolCheckOptions {
|
|
104
113
|
/** The directory the tool installs into, an absolute path: {@link ciToolDir} under the image's tool root. */
|
|
105
114
|
dir: string;
|
|
@@ -113,6 +122,8 @@ export interface CiToolFetchOptions extends CiToolCheckOptions {
|
|
|
113
122
|
* /opt. The download and the check run as the job's user. Default false.
|
|
114
123
|
*/
|
|
115
124
|
sudo?: boolean;
|
|
125
|
+
/** Download with curl (the default) or with node, for an image with no curl or unzip (#4952). */
|
|
126
|
+
download?: CiToolDownload;
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
129
|
* Shell that downloads one release into `dir` and checks it (#4784). Run it
|
|
@@ -144,6 +155,12 @@ export interface CiToolInstallOptions extends CiToolCheckOptions {
|
|
|
144
155
|
sudo?: boolean;
|
|
145
156
|
/** Skip the install when any `<bin>` is on PATH, whatever its version. Default false: only the versioned directory counts. */
|
|
146
157
|
onPath?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Download with curl (the default) or with node (#4952), for a job whose
|
|
160
|
+
* image carries node but neither curl nor unzip, such as terragucci's
|
|
161
|
+
* images installing the AWS CLI for drift attribution.
|
|
162
|
+
*/
|
|
163
|
+
download?: CiToolDownload;
|
|
147
164
|
}
|
|
148
165
|
/** Where a job line installs each release by default. */
|
|
149
166
|
export declare const CI_TOOL_ROOT = "/opt/chant";
|
package/dist/ci-image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-image.d.ts","sourceRoot":"","sources":["../src/ci-image.ts"],"names":[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C,EAAE,MAAM,EAAE,CAAC;IACf,8HAA8H;IAC9H,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,iGAAiG;IACjG,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0BAA0B;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAmED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,EAAE,CA4DzE;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,MAAM,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAWtG;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAErG;AAED,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,wGAAwG;AACxG,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAGrE"}
|
package/dist/ci-image.js
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* checks it, for an image's fetch stage; {@link ciToolInstallLine} is the
|
|
19
19
|
* job line that runs it unless the binary is there (with `sudo`, or under
|
|
20
20
|
* a root such as `$RUNNER_TEMP/chant-tools`, for a job that is not root,
|
|
21
|
-
* #4908)
|
|
21
|
+
* #4908). With `download: "node"` both fetch and unpack with node, for
|
|
22
|
+
* an image with no curl or unzip (#4952). {@link installCiTool} does the same from Node, for a product
|
|
22
23
|
* that installs a pinned release at run time.
|
|
23
24
|
* - {@link productImageStages} is a product's image as stages a Dockerfile
|
|
24
25
|
* takes (the docker lexicon's `new Dockerfile({ stages })`), and
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
* project publishes a checksums file is checked against that file's line
|
|
32
33
|
* for the archive, and against the recorded sha256 when there is one, so a
|
|
33
34
|
* tampered checksums file fails as a tampered archive does. A release with
|
|
34
|
-
* no checksums file (the AWS CLI, just
|
|
35
|
+
* no checksums file (the AWS CLI, just before 1.35.0) needs a recorded sha256. An
|
|
35
36
|
* image always needs a recorded sha256 for both architectures, and a caller
|
|
36
37
|
* passes `requirePin` to ask the same of a job line or a run-time install.
|
|
37
38
|
*
|
|
@@ -46,9 +47,14 @@ import { tmpdir } from "node:os";
|
|
|
46
47
|
import { join } from "node:path";
|
|
47
48
|
import { gunzipSync, inflateRawSync } from "node:zlib";
|
|
48
49
|
import { tarEntry } from "./policy-engine.js";
|
|
49
|
-
import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR } from "./release-floors.js";
|
|
50
|
-
export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR };
|
|
50
|
+
import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR } from "./release-floors.js";
|
|
51
|
+
export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR };
|
|
51
52
|
export const CI_TOOL_ARCHES = ["amd64", "arm64"];
|
|
53
|
+
/** Whether a release version is at least `major.minor`. */
|
|
54
|
+
function atLeast(version, major, minor) {
|
|
55
|
+
const [a = 0, b = 0] = version.split(".").map((n) => Number.parseInt(n, 10));
|
|
56
|
+
return a > major || (a === major && b >= minor);
|
|
57
|
+
}
|
|
52
58
|
const STD = { amd64: "amd64", arm64: "arm64" };
|
|
53
59
|
const GNU = { amd64: "x86_64", arm64: "aarch64" };
|
|
54
60
|
const NODE_WORDS = { amd64: "x64", arm64: "arm64" };
|
|
@@ -148,6 +154,8 @@ const TOOLS = {
|
|
|
148
154
|
words: GNU,
|
|
149
155
|
base: (v) => `https://github.com/casey/just/releases/download/${v}`,
|
|
150
156
|
asset: (v, w) => `just-${v}-${w}-unknown-linux-musl.tar.gz`,
|
|
157
|
+
// #4952: just publishes `SHA256SUMS` from 1.37.0, one `<file>.sha256sum` per file in 1.35.0 and 1.36.0, and none before.
|
|
158
|
+
checksums: (v, asset) => (atLeast(v, 1, 37) ? "SHA256SUMS" : atLeast(v, 1, 35) ? `${asset}.sha256sum` : undefined),
|
|
151
159
|
layout: "tar.gz",
|
|
152
160
|
},
|
|
153
161
|
act: {
|
|
@@ -155,6 +163,7 @@ const TOOLS = {
|
|
|
155
163
|
words: { amd64: "x86_64", arm64: "arm64" },
|
|
156
164
|
base: (v) => `https://github.com/nektos/act/releases/download/v${v}`,
|
|
157
165
|
asset: (_v, w) => `act_Linux_${w}.tar.gz`,
|
|
166
|
+
checksums: () => "checksums.txt",
|
|
158
167
|
layout: "tar.gz",
|
|
159
168
|
},
|
|
160
169
|
};
|
|
@@ -188,6 +197,14 @@ export const CI_TOOL_SHA256 = {
|
|
|
188
197
|
"terragrunt-1.2.0-linux-arm64": "b069ce4310572bc46ee6f057057acc4bc6a9077ef8687e157a64b0551290a371",
|
|
189
198
|
"aws-cli-2.37.9-linux-amd64": "6b3a6a3d7bb3997928f0bdf7b866914224abf242c2e54e1dcebbe84bee64f356",
|
|
190
199
|
"aws-cli-2.37.9-linux-arm64": "e7d2cca3622af4765871fe9ce7eeed03acd09dca10a99ebc46e92f79d78765c0",
|
|
200
|
+
// #4952: terragucci's just and act pins (its workflows/shared.ts), read on 2026-11-10 from
|
|
201
|
+
// https://github.com/casey/just/releases/download/1.36.0/just-1.36.0-{x86_64,aarch64}-unknown-linux-musl.tar.gz.sha256sum
|
|
202
|
+
// and https://github.com/nektos/act/releases/download/v0.2.89/checksums.txt.
|
|
203
|
+
// squawk is not here: its releases publish no checksums file, only bare binaries, and no product pins a release.
|
|
204
|
+
"just-1.36.0-linux-amd64": "bc7c9f377944f8de9cd0418b11d2955adebfa25a488c0b5e3dd2d2c0e9d732da",
|
|
205
|
+
"just-1.36.0-linux-arm64": "bb3886b15e2cbcb9c0eb19956297d36de4eaef45b89d3f5fa5d1fc4ed3b5b51d",
|
|
206
|
+
"act-0.2.89-linux-amd64": "0191d6f1f3b716b5c55820032605d05fc3c1cdbf581ebeff655019e5dd1524c0",
|
|
207
|
+
"act-0.2.89-linux-arm64": "daa8679ba9615a74d2d0cec321dc593f21948a2a11bb65862b063d8b930f4bcb",
|
|
191
208
|
};
|
|
192
209
|
const VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?$/;
|
|
193
210
|
const SHA256 = /^[0-9a-f]{64}$/;
|
|
@@ -265,8 +282,39 @@ export function ciToolBin(tool, version, root) {
|
|
|
265
282
|
export const CI_TOOL_JOB_ARCH = `"$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"`;
|
|
266
283
|
/** A Docker build's target architecture (`ARG TARGETARCH`), amd64 or arm64. */
|
|
267
284
|
export const CI_TOOL_DOCKER_ARCH = `"$TARGETARCH"`;
|
|
285
|
+
/** The download line's script for `download: "node"`: `node -e <it> <url> <file>`. A failed answer exits 1 naming the URL and the status. */
|
|
286
|
+
const NODE_FETCH_JS = 'const [u,o]=process.argv.slice(1);fetch(u).then(async(r)=>{if(!r.ok)throw new Error(u+": HTTP "+r.status);require("fs").writeFileSync(o,Buffer.from(await r.arrayBuffer()))}).catch((e)=>{console.error(e.message);process.exit(1)})';
|
|
287
|
+
/**
|
|
288
|
+
* The unpack line's script for `download: "node"`: `node -e <it> <zip>
|
|
289
|
+
* <dir> [member]`, every entry (or the one member) written under `dir`
|
|
290
|
+
* with its executable bit and symbolic links kept, as the AWS CLI's
|
|
291
|
+
* installer needs. Stored and deflated entries only, as {@link unzipEntry}
|
|
292
|
+
* reads them; an entry whose path leaves `dir` fails the line. Written with
|
|
293
|
+
* no single quote or `$`, so it goes inside the shell's single quotes as it is.
|
|
294
|
+
*/
|
|
295
|
+
const NODE_UNZIP_JS = [
|
|
296
|
+
'const fs=require("fs"),p=require("path"),z=require("zlib");const [f,d,m]=process.argv.slice(1);const b=fs.readFileSync(f);',
|
|
297
|
+
'let e=b.length-22;while(e>=0&&b.readUInt32LE(e)!==0x06054b50)e--;if(e<0)throw new Error(f+" is not a zip archive");',
|
|
298
|
+
"const top=p.resolve(d);let o=b.readUInt32LE(e+16),hit=false;",
|
|
299
|
+
"for(let i=b.readUInt16LE(e+10);i>0;i--){",
|
|
300
|
+
'const meth=b.readUInt16LE(o+10),size=b.readUInt32LE(o+20),nl=b.readUInt16LE(o+28),xl=b.readUInt16LE(o+30),cl=b.readUInt16LE(o+32),mode=b.readUInt32LE(o+38)>>>16,l=b.readUInt32LE(o+42),n=b.toString("utf8",o+46,o+46+nl);',
|
|
301
|
+
"o+=46+nl+xl+cl;if(m&&n!==m)continue;hit=true;",
|
|
302
|
+
'const t=p.resolve(top,n);if(t!==top&&!t.startsWith(top+p.sep))throw new Error(n+" is outside "+d);',
|
|
303
|
+
'if(n.endsWith("/")){fs.mkdirSync(t,{recursive:true});continue}',
|
|
304
|
+
"const s=l+30+b.readUInt16LE(l+26)+b.readUInt16LE(l+28),raw=b.subarray(s,s+size),data=meth===0?raw:meth===8?z.inflateRawSync(raw):null;",
|
|
305
|
+
'if(!data)throw new Error(n+" uses compression method "+meth);fs.mkdirSync(p.dirname(t),{recursive:true});',
|
|
306
|
+
"if((mode&0o170000)===0o120000)fs.symlinkSync(data.toString(),t);else fs.writeFileSync(t,data,{mode:mode&0o111?0o755:0o644})}",
|
|
307
|
+
'if(m&&!hit)throw new Error(m+" is not in "+f)',
|
|
308
|
+
].join("");
|
|
309
|
+
function checkDownload(download) {
|
|
310
|
+
if (download === undefined || download === "curl")
|
|
311
|
+
return "curl";
|
|
312
|
+
if (download === "node")
|
|
313
|
+
return "node";
|
|
314
|
+
throw new Error(`download is curl or node, not ${JSON.stringify(download)}`);
|
|
315
|
+
}
|
|
268
316
|
function needPins(tool, version, sums, requirePin) {
|
|
269
|
-
const hasSums = spec(tool).checksums !== undefined;
|
|
317
|
+
const hasSums = spec(tool).checksums?.(version, "") !== undefined;
|
|
270
318
|
const missing = CI_TOOL_ARCHES.filter((a) => !sums[a]);
|
|
271
319
|
if (missing.length && (requirePin || !hasSums)) {
|
|
272
320
|
const why = hasSums ? "" : `; ${tool}'s release publishes no checksums file, so chant needs one`;
|
|
@@ -286,6 +334,10 @@ export function ciToolFetchScript(tool, version, options) {
|
|
|
286
334
|
const s = spec(tool);
|
|
287
335
|
const sums = ciToolSha256(tool, version, options.sha256);
|
|
288
336
|
needPins(tool, version, sums, options.requirePin === true);
|
|
337
|
+
const node = checkDownload(options.download) === "node";
|
|
338
|
+
// #4952: `get <url word> <file>` and `unzipTo <zip> <dir> [member]`, with curl and unzip or with node.
|
|
339
|
+
const get = (url, out) => (node ? `node -e '${NODE_FETCH_JS}' ${url} "${out}"` : `curl -fsSLo "${out}" ${url}`);
|
|
340
|
+
const unzipTo = (zipFile, into, member) => node ? `node -e '${NODE_UNZIP_JS}' "${zipFile}" "${into}"${member ? ` "${member}"` : ""}` : `unzip -q${member ? " -o" : ""} "${zipFile}"${member ? ` "${member}"` : ""} -d "${into}"`;
|
|
289
341
|
const name = `${tool} ${version}`;
|
|
290
342
|
const base = s.base(version);
|
|
291
343
|
const file = s.asset(version, "$w");
|
|
@@ -295,12 +347,12 @@ export function ciToolFetchScript(tool, version, options) {
|
|
|
295
347
|
`case "$a" in ${CI_TOOL_ARCHES.map((a) => `(${a}) w=${s.words[a]} ;;`).join(" ")} (*) echo "${name}: chant fetches it for ${CI_TOOL_ARCHES.join(" and ")}, not $a" >&2; exit 1 ;; esac`,
|
|
296
348
|
`f="${file}"`,
|
|
297
349
|
`t="$(mktemp -d)"`,
|
|
298
|
-
`
|
|
350
|
+
get(`"${base}/$f"`, "$t/$f"),
|
|
299
351
|
`case "$a" in ${CI_TOOL_ARCHES.filter((a) => sums[a]).map((a) => `(${a}) want=${sums[a]} ;;`).join(" ")} (*) want= ;; esac`,
|
|
300
352
|
];
|
|
301
353
|
const checksums = s.checksums?.(version, file);
|
|
302
354
|
if (checksums) {
|
|
303
|
-
lines.push(
|
|
355
|
+
lines.push(get(options.checksumsUrl ?? `"${base}/${checksums}"`, "$t/sums"),
|
|
304
356
|
// The archive's line, with any ./ or * before the name taken off.
|
|
305
357
|
`line="$(sed -n "s#^\\([0-9a-f]\\{64\\}\\) *[*.]*/*$f\\$#\\1#p" "$t/sums")"`, `{ [ -n "$line" ] || { echo "${name}: $f is not in ${checksums}" >&2; exit 1; }; }`, `{ [ -z "$want" ] || [ "$line" = "$want" ] || { echo "${name}: ${checksums} lists $line for $f; chant records $want" >&2; exit 1; }; }`, `want="$line"`);
|
|
306
358
|
}
|
|
@@ -317,13 +369,13 @@ export function ciToolFetchScript(tool, version, options) {
|
|
|
317
369
|
lines.push(`tar -xzf "$t/$f" -C "$t" "${member}"`, `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
|
|
318
370
|
break;
|
|
319
371
|
case "zip":
|
|
320
|
-
lines.push(
|
|
372
|
+
lines.push(unzipTo("$t/$f", "$t", member), `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
|
|
321
373
|
break;
|
|
322
374
|
case "tree":
|
|
323
375
|
lines.push(`${su}tar -xzf "$t/$f" -C "${dir}" --strip-components=1`);
|
|
324
376
|
break;
|
|
325
377
|
case "aws-cli":
|
|
326
|
-
lines.push(
|
|
378
|
+
lines.push(unzipTo("$t/$f", "$t"), `${su}"$t/aws/install" -i "${dir}" -b "${dir}/bin"`);
|
|
327
379
|
break;
|
|
328
380
|
}
|
|
329
381
|
return lines.join(" && ");
|
|
@@ -346,7 +398,7 @@ export function ciToolInstallLine(tool, version, options = {}) {
|
|
|
346
398
|
if (!SHELL_DIR.test(binDir))
|
|
347
399
|
throw new Error(`binDir is an absolute path of letters, digits and ._/-, or one under a variable such as $HOME, not ${JSON.stringify(options.binDir)}`);
|
|
348
400
|
const su = options.sudo ? "sudo " : "";
|
|
349
|
-
const install = `(set -e; ${ciToolFetchScript(tool, version, { dir, sha256: options.sha256, requirePin: options.requirePin, sudo: options.sudo })})`;
|
|
401
|
+
const install = `(set -e; ${ciToolFetchScript(tool, version, { dir, sha256: options.sha256, requirePin: options.requirePin, sudo: options.sudo, download: options.download })})`;
|
|
350
402
|
const inDir = `[ -x "${bin}" ]`;
|
|
351
403
|
// A plain path is written as it always was; one under a variable is quoted, so the shell expands it as one word.
|
|
352
404
|
const target = DIR.test(binDir) ? `${binDir}/${s.bin}` : `"${binDir}/${s.bin}"`;
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
* token and holds no cloud credentials.
|
|
28
28
|
*/
|
|
29
29
|
import { type CiProductWords, type ParsedProductComment } from "./ci-product-words.js";
|
|
30
|
-
import { type GitlabForgeOptions, type PrForge } from "./pr-forge.js";
|
|
31
|
-
import type { ForgeReads, PullRequestDetail, PullRequestNote } from "./pr-forge-reads.js";
|
|
30
|
+
import { type ForgeKind, type GitlabForgeOptions, type PrForge } from "./pr-forge.js";
|
|
31
|
+
import type { ForgeReads, PullRequestDetail, PullRequestNote, RunJob, WorkflowRun } from "./pr-forge-reads.js";
|
|
32
32
|
export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline.js";
|
|
33
33
|
/** How far back the poll reads: merge requests updated, and notes written, in this many minutes. */
|
|
34
34
|
export declare const NOTE_COMMANDS_WINDOW_MINUTES: number;
|
|
@@ -165,6 +165,56 @@ export interface NotePoll {
|
|
|
165
165
|
export declare function pollNoteCommands(o: NoteCommandsOptions): Promise<NotePoll>;
|
|
166
166
|
/** chant's apply jobs and terragucci's: `apply`, `apply-wave-<n>` and `apply-wave-<n>-share-<m>`, a member's prefixed with its name. */
|
|
167
167
|
export declare const APPLY_JOBS: RegExp;
|
|
168
|
+
/** What starting a merge commit's apply again came to: a reply alone, a run started (`ran`), or a forge answer that broke it. */
|
|
169
|
+
export type ApplyRetried = {
|
|
170
|
+
kind: "reply";
|
|
171
|
+
text: string;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "ran";
|
|
174
|
+
text: string;
|
|
175
|
+
url?: string;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "fail";
|
|
178
|
+
reason: string;
|
|
179
|
+
};
|
|
180
|
+
/** What {@link ApplyRerun} is told: the merge commit, the pull request's name in a reply, who asked, and the default branch. */
|
|
181
|
+
export interface ApplyRerunContext {
|
|
182
|
+
sha: string;
|
|
183
|
+
/** `!12`, or `pull request 12`. */
|
|
184
|
+
at: string;
|
|
185
|
+
user: string;
|
|
186
|
+
base: string;
|
|
187
|
+
/** The pattern the apply jobs matched, whose groups are the wave and the share. */
|
|
188
|
+
pattern: RegExp;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* How a forge starts a merge commit's apply again (#4946), once
|
|
192
|
+
* {@link retryApply} found the push run at the commit with apply jobs and no
|
|
193
|
+
* later apply. GitLab retries the first apply job that did not succeed
|
|
194
|
+
* ({@link gitlabRetry}); GitHub and Forgejo answer in ./ci-comment-commands.ts.
|
|
195
|
+
*/
|
|
196
|
+
export type ApplyRerun = (run: WorkflowRun, jobs: RunJob[], c: ApplyRerunContext) => Promise<ApplyRetried>;
|
|
197
|
+
/** What {@link retryApply} reads with. */
|
|
198
|
+
export interface ApplyRetryReads {
|
|
199
|
+
reads: ForgeReads;
|
|
200
|
+
/** chant's client: it reads the later commits' statuses. */
|
|
201
|
+
forge: Pick<PrForge, "commitStatuses">;
|
|
202
|
+
words: CiProductWords;
|
|
203
|
+
/** The default branch. */
|
|
204
|
+
base: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Start a merged pull request's apply again (#4785; shared with GitHub and
|
|
208
|
+
* Forgejo in #4946): the newest push run at the merge commit that has an
|
|
209
|
+
* apply job, refused when a later commit of the default branch already
|
|
210
|
+
* carries the product's apply status, since going back to this one would
|
|
211
|
+
* undo it. `rerun` is the forge's own start.
|
|
212
|
+
*/
|
|
213
|
+
export declare function retryApply(o: ApplyRetryReads, forgeKind: ForgeKind, mr: PullRequestDetail, user: string, run: Extract<NoteRun, {
|
|
214
|
+
kind: "retry";
|
|
215
|
+
}>, rerun: ApplyRerun): Promise<ApplyRetried>;
|
|
216
|
+
/** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
|
|
217
|
+
export declare function gitlabRetry(pipelines: Pick<GitlabPipelines, "retryJob">): ApplyRerun;
|
|
168
218
|
/** The jobs chant's GitLab pipeline has, which {@link chantNoteRuns} starts. */
|
|
169
219
|
export interface ChantNoteJobs {
|
|
170
220
|
/** The comment preview (`--preview-comment`): a plan starts it with `CHANT_PREVIEW_PR`. Without it a plan starts a merge request pipeline. */
|
|
@@ -179,8 +229,18 @@ export interface ChantNoteJobs {
|
|
|
179
229
|
agent?: boolean;
|
|
180
230
|
/** The commit jobs, started with `CHANT_COMMIT_PR`, `CHANT_COMMIT` and `CHANT_COMMIT_ARG`. */
|
|
181
231
|
commits?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* The members the pipeline was written with (#4946), such as terragucci's
|
|
234
|
+
* roots: a plan or an action naming any other gets the words' `member`
|
|
235
|
+
* reply, and nothing starts. Absent: any member a comment may name.
|
|
236
|
+
*/
|
|
237
|
+
members?: readonly string[];
|
|
182
238
|
}
|
|
183
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* What a command runs in chant's own GitLab pipeline, for the jobs it has.
|
|
241
|
+
* A command no job runs gets the words' reply for it (`words.replies`,
|
|
242
|
+
* #4946), else chant's.
|
|
243
|
+
*/
|
|
184
244
|
export declare function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns;
|
|
185
245
|
/** The directory on `chant/lifecycle` that keeps the notes the poll answered. */
|
|
186
246
|
export declare const NOTES_DIR = "_notes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-note-commands.d.ts","sourceRoot":"","sources":["../src/ci-note-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"ci-note-commands.d.ts","sourceRoot":"","sources":["../src/ci-note-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAAoE,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGtJ,OAAO,EAAkC,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACnH,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,oGAAoG;AACpG,eAAO,MAAM,4BAA4B,QAAU,CAAC;AAEpD,oGAAoG;AACpG,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,0EAA0E;AAC1E,eAAO,MAAM,YAAY,YAAI,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAU,CAAC;AAErH,gHAAgH;AAChH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAA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IAC9F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,eAAe,CAkDlE;AAED,iFAAiF;AACjF,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAiBlF"}
|
package/dist/ci-note-commands.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
import { GITLAB_AGENT_ASK_VAR, GITLAB_AGENT_PR_VAR } from "./ci-agent.js";
|
|
30
30
|
import { GITLAB_COMMIT_ARG_VAR, GITLAB_COMMIT_PR_VAR, GITLAB_COMMIT_WORD_VAR } from "./ci-commit.js";
|
|
31
31
|
import { parseProductComment, productStatusContext } from "./ci-product-words.js";
|
|
32
|
+
import { commandLine, commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-replies.js";
|
|
32
33
|
import { GITLAB_APPLY_PR_VAR, GITLAB_LOCK_PR_VAR, GITLAB_PREVIEW_PR_VAR, GITLAB_UNLOCK_PR_VAR, PREVIEW_COMMENT_ENV } from "./components/pr-pipeline.js";
|
|
33
34
|
import { ForgeApiError } from "./pr-forge.js";
|
|
34
35
|
export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline.js";
|
|
@@ -204,17 +205,32 @@ async function answer(o, mr, note, least, at, me) {
|
|
|
204
205
|
}
|
|
205
206
|
return reply(`started pipeline${link(started)} to ${run.doing} for ${note.author}`, true, started.url);
|
|
206
207
|
}
|
|
207
|
-
case "retry":
|
|
208
|
-
|
|
208
|
+
case "retry": {
|
|
209
|
+
const done = await retryApply(o, "gitlab", mr, note.author, run, gitlabRetry(o.pipelines));
|
|
210
|
+
if (done.kind === "fail")
|
|
211
|
+
return broke(done.reason);
|
|
212
|
+
return reply(done.text, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
|
|
213
|
+
}
|
|
209
214
|
}
|
|
210
215
|
}
|
|
211
216
|
/** chant's apply jobs and terragucci's: `apply`, `apply-wave-<n>` and `apply-wave-<n>-share-<m>`, a member's prefixed with its name. */
|
|
212
217
|
export const APPLY_JOBS = /^(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(?:-share-([1-9][0-9]*))?)?$/;
|
|
213
218
|
const NOT_DONE = new Set(["created", "pending", "running", "waiting_for_resource", "preparing", "scheduled"]);
|
|
214
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Start a merged pull request's apply again (#4785; shared with GitHub and
|
|
221
|
+
* Forgejo in #4946): the newest push run at the merge commit that has an
|
|
222
|
+
* apply job, refused when a later commit of the default branch already
|
|
223
|
+
* carries the product's apply status, since going back to this one would
|
|
224
|
+
* undo it. `rerun` is the forge's own start.
|
|
225
|
+
*/
|
|
226
|
+
export async function retryApply(o, forgeKind, mr, user, run, rerun) {
|
|
215
227
|
const { sha } = run;
|
|
216
228
|
const pattern = run.jobs ?? APPLY_JOBS;
|
|
217
|
-
const
|
|
229
|
+
const t = commentTerms(forgeKind);
|
|
230
|
+
const at = t.at(mr.number);
|
|
231
|
+
const gitlab = forgeKind === "gitlab";
|
|
232
|
+
const runWord = gitlab ? "pipeline" : "workflow run";
|
|
233
|
+
const reply = (text) => ({ kind: "reply", text });
|
|
218
234
|
// The newest push pipeline at the merge commit with an apply job: a branch pipeline, or a ci/green tag's.
|
|
219
235
|
let pipeline;
|
|
220
236
|
let jobs = [];
|
|
@@ -229,11 +245,11 @@ async function retry(o, mr, user, run, reply, broke) {
|
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
if (!pipeline)
|
|
232
|
-
return reply(`no
|
|
248
|
+
return reply(`no ${runWord} at the merge commit ${short(sha)} of ${at} has an apply job, so there is nothing to ${gitlab ? "retry" : "run again"}; push to ${o.base} again`);
|
|
233
249
|
newer = await o.reads.branchRuns(o.base, { event: "push", limit: NOTE_COMMANDS_NEWER_PIPELINES });
|
|
234
250
|
}
|
|
235
251
|
catch (e) {
|
|
236
|
-
return
|
|
252
|
+
return { kind: "fail", reason: `could not read the ${runWord}s at ${short(sha)} (${message(e)})` };
|
|
237
253
|
}
|
|
238
254
|
// A later commit whose apply started applied a newer tree: going back to this one would undo it.
|
|
239
255
|
const applyContext = productStatusContext(o.words, "apply");
|
|
@@ -244,46 +260,64 @@ async function retry(o, mr, user, run, reply, broke) {
|
|
|
244
260
|
applied = (await o.forge.commitStatuses?.(c))?.find((s) => s.context === applyContext);
|
|
245
261
|
}
|
|
246
262
|
catch (e) {
|
|
247
|
-
return
|
|
263
|
+
return { kind: "fail", reason: `could not read the statuses of ${short(c)} (${message(e)})` };
|
|
248
264
|
}
|
|
249
265
|
if (applied) {
|
|
250
|
-
const
|
|
251
|
-
return reply(`a later apply already ran on ${o.base} at ${short(c)}${
|
|
266
|
+
const link = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
|
|
267
|
+
return reply(`a later apply already ran on ${o.base} at ${short(c)}${link}, so the merge commit ${short(sha)} of ${at} is not applied: comment on the ${t.request} that commit came from, or push again`);
|
|
252
268
|
}
|
|
253
269
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
270
|
+
return rerun(pipeline, jobs, { sha, at, user, base: o.base, pattern });
|
|
271
|
+
}
|
|
272
|
+
/** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
|
|
273
|
+
export function gitlabRetry(pipelines) {
|
|
274
|
+
return async (pipeline, jobs, { sha, at, user, base, pattern }) => {
|
|
275
|
+
const reply = (text) => ({ kind: "reply", text });
|
|
276
|
+
const order = (j) => {
|
|
277
|
+
const m = pattern.exec(j.name);
|
|
278
|
+
return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
|
|
279
|
+
};
|
|
280
|
+
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
281
|
+
const next = sorted.find((j) => j.status !== "success");
|
|
282
|
+
if (!next)
|
|
283
|
+
return reply(`every apply job of ${at}'s merge commit ${short(sha)} already succeeded`);
|
|
284
|
+
if (NOT_DONE.has(next.status))
|
|
285
|
+
return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
286
|
+
if (next.status !== "failed" && next.status !== "canceled") {
|
|
287
|
+
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${base} again`);
|
|
288
|
+
}
|
|
289
|
+
let retried;
|
|
290
|
+
try {
|
|
291
|
+
retried = await pipelines.retryJob(next.id);
|
|
292
|
+
}
|
|
293
|
+
catch (e) {
|
|
294
|
+
return { kind: "fail", reason: `could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})` };
|
|
295
|
+
}
|
|
296
|
+
const link = retried.url ? ` (${retried.url})` : "";
|
|
297
|
+
return { kind: "ran", text: `retried ${next.name} of ${at}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, ...(retried.url ? { url: retried.url } : {}) };
|
|
257
298
|
};
|
|
258
|
-
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
259
|
-
const next = sorted.find((j) => j.status !== "success");
|
|
260
|
-
if (!next)
|
|
261
|
-
return reply(`every apply job of !${iid}'s merge commit ${short(sha)} already succeeded`);
|
|
262
|
-
if (NOT_DONE.has(next.status))
|
|
263
|
-
return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
264
|
-
if (next.status !== "failed" && next.status !== "canceled") {
|
|
265
|
-
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${o.base} again`);
|
|
266
|
-
}
|
|
267
|
-
let retried;
|
|
268
|
-
try {
|
|
269
|
-
retried = await o.pipelines.retryJob(next.id);
|
|
270
|
-
}
|
|
271
|
-
catch (e) {
|
|
272
|
-
return broke(`could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})`);
|
|
273
|
-
}
|
|
274
|
-
const link = retried.url ? ` (${retried.url})` : "";
|
|
275
|
-
return reply(`retried ${next.name} of !${iid}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, true, retried.url);
|
|
276
299
|
}
|
|
277
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* What a command runs in chant's own GitLab pipeline, for the jobs it has.
|
|
302
|
+
* A command no job runs gets the words' reply for it (`words.replies`,
|
|
303
|
+
* #4946), else chant's.
|
|
304
|
+
*/
|
|
278
305
|
export function chantNoteRuns(jobs) {
|
|
279
306
|
return ({ mr, note, parsed, base, words }) => {
|
|
280
307
|
const iid = String(mr.number);
|
|
281
308
|
const at = `!${mr.number}`;
|
|
282
|
-
const line = (kind) =>
|
|
309
|
+
const line = (kind) => commandLine(words, kind);
|
|
310
|
+
// #4946: a member outside the pipeline's is refused before anything starts, a fork's included.
|
|
311
|
+
const member = parsed.kind === "plan" || parsed.kind === "action" ? parsed.member : undefined;
|
|
312
|
+
if (member !== undefined && jobs.members && !jobs.members.includes(member))
|
|
313
|
+
return { kind: "reply", text: memberReply(words, member, jobs.members, "gitlab") };
|
|
283
314
|
if (!mr.sameRepo)
|
|
284
|
-
return { kind: "reply", text:
|
|
315
|
+
return { kind: "reply", text: forkReply(words, "gitlab") };
|
|
285
316
|
const open = mr.state === "open";
|
|
286
317
|
const intoBase = mr.base === undefined || mr.base === base;
|
|
318
|
+
// #4946: the product's sentence for an apply no job answers, in place of chant's, which say what the merge does.
|
|
319
|
+
if (parsed.kind === "apply" && !jobs.applyBeforeMerge && !jobs.applyOnMerge && words.replies?.apply !== undefined)
|
|
320
|
+
return { kind: "reply", text: words.replies.apply };
|
|
287
321
|
switch (parsed.kind) {
|
|
288
322
|
case "plan":
|
|
289
323
|
if (!open)
|
|
@@ -314,13 +348,13 @@ export function chantNoteRuns(jobs) {
|
|
|
314
348
|
case "lock":
|
|
315
349
|
case "unlock":
|
|
316
350
|
if (!jobs.locks)
|
|
317
|
-
return { kind: "reply", text:
|
|
351
|
+
return { kind: "reply", text: notRunReply(words, parsed.kind, "gitlab") };
|
|
318
352
|
if (parsed.kind === "lock" && !open)
|
|
319
353
|
return { kind: "reply", text: `${at} is not open, so it takes no lock` };
|
|
320
354
|
return { kind: "pipeline", ref: base, variables: { [parsed.kind === "lock" ? GITLAB_LOCK_PR_VAR : GITLAB_UNLOCK_PR_VAR]: iid }, doing: `${parsed.kind} the ${words.noun[1]} of ${at}` };
|
|
321
355
|
case "agent":
|
|
322
356
|
if (!jobs.agent)
|
|
323
|
-
return { kind: "reply", text:
|
|
357
|
+
return { kind: "reply", text: notRunReply(words, "agent", "gitlab") };
|
|
324
358
|
if (!open)
|
|
325
359
|
return { kind: "reply", text: `${at} is not open, so the agent does not run` };
|
|
326
360
|
if (mr.head === base)
|