@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.
Files changed (303) hide show
  1. package/dist/actor.d.ts +36 -1
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/actor.js +39 -1
  4. package/dist/chant-install.d.ts.map +1 -1
  5. package/dist/chant-install.js +1 -2
  6. package/dist/ci-base.d.ts +30 -0
  7. package/dist/ci-base.d.ts.map +1 -0
  8. package/dist/ci-base.js +33 -0
  9. package/dist/ci-comment-commands.d.ts +177 -0
  10. package/dist/ci-comment-commands.d.ts.map +1 -0
  11. package/dist/ci-comment-commands.js +325 -0
  12. package/dist/ci-comment-replies.d.ts +40 -0
  13. package/dist/ci-comment-replies.d.ts.map +1 -0
  14. package/dist/ci-comment-replies.js +59 -0
  15. package/dist/ci-evidence-from-job.d.ts +25 -0
  16. package/dist/ci-evidence-from-job.d.ts.map +1 -1
  17. package/dist/ci-evidence-from-job.js +43 -2
  18. package/dist/ci-evidence-jobs.d.ts +30 -1
  19. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  20. package/dist/ci-evidence-jobs.js +46 -3
  21. package/dist/ci-image.d.ts +21 -4
  22. package/dist/ci-image.d.ts.map +1 -1
  23. package/dist/ci-image.js +62 -10
  24. package/dist/ci-note-commands.d.ts +63 -3
  25. package/dist/ci-note-commands.d.ts.map +1 -1
  26. package/dist/ci-note-commands.js +69 -35
  27. package/dist/ci-product-words.d.ts +42 -0
  28. package/dist/ci-product-words.d.ts.map +1 -1
  29. package/dist/ci-product-words.js +25 -0
  30. package/dist/ci-product.d.ts +31 -0
  31. package/dist/ci-product.d.ts.map +1 -1
  32. package/dist/ci-product.js +34 -4
  33. package/dist/cli/commands/build.d.ts.map +1 -1
  34. package/dist/cli/commands/build.js +29 -2
  35. package/dist/cli/handlers/approve.d.ts.map +1 -1
  36. package/dist/cli/handlers/approve.js +2 -1
  37. package/dist/cli/handlers/ci-check.d.ts +1 -1
  38. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  39. package/dist/cli/handlers/ci-check.js +17 -7
  40. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  41. package/dist/cli/handlers/ci-evidence.js +33 -7
  42. package/dist/cli/handlers/components.d.ts.map +1 -1
  43. package/dist/cli/handlers/components.js +3 -1
  44. package/dist/cli/handlers/generated-check.d.ts +8 -0
  45. package/dist/cli/handlers/generated-check.d.ts.map +1 -1
  46. package/dist/cli/handlers/generated-check.js +31 -1
  47. package/dist/cli/handlers/lock.d.ts.map +1 -1
  48. package/dist/cli/handlers/lock.js +121 -4
  49. package/dist/cli/handlers/pr-comment.d.ts +21 -0
  50. package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
  51. package/dist/cli/handlers/pr-comment.js +112 -0
  52. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  53. package/dist/cli/handlers/pr-env.js +6 -3
  54. package/dist/cli/handlers/pr.d.ts +23 -1
  55. package/dist/cli/handlers/pr.d.ts.map +1 -1
  56. package/dist/cli/handlers/pr.js +55 -9
  57. package/dist/cli/handlers/promote.d.ts.map +1 -1
  58. package/dist/cli/handlers/promote.js +2 -1
  59. package/dist/cli/handlers/release.d.ts.map +1 -1
  60. package/dist/cli/handlers/release.js +11 -2
  61. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  62. package/dist/cli/handlers/run-wave.js +28 -2
  63. package/dist/cli/handlers/run.d.ts.map +1 -1
  64. package/dist/cli/handlers/run.js +2 -1
  65. package/dist/cli/main.d.ts.map +1 -1
  66. package/dist/cli/main.js +24 -2
  67. package/dist/cli/parse-args.d.ts.map +1 -1
  68. package/dist/cli/parse-args.js +16 -0
  69. package/dist/cli/registry.d.ts +11 -0
  70. package/dist/cli/registry.d.ts.map +1 -1
  71. package/dist/components/auto-release.d.ts.map +1 -1
  72. package/dist/components/auto-release.js +2 -1
  73. package/dist/components/pr-checks.d.ts +70 -6
  74. package/dist/components/pr-checks.d.ts.map +1 -1
  75. package/dist/components/pr-checks.js +74 -13
  76. package/dist/components/pr-pipeline.d.ts +16 -12
  77. package/dist/components/pr-pipeline.d.ts.map +1 -1
  78. package/dist/components/pr-pipeline.js +3 -11
  79. package/dist/components/product-pipeline.d.ts +42 -1
  80. package/dist/components/product-pipeline.d.ts.map +1 -1
  81. package/dist/components/product-pipeline.js +64 -12
  82. package/dist/components/product-plan.d.ts +190 -5
  83. package/dist/components/product-plan.d.ts.map +1 -1
  84. package/dist/components/product-plan.js +220 -39
  85. package/dist/drift-record.d.ts +7 -0
  86. package/dist/drift-record.d.ts.map +1 -1
  87. package/dist/drift-record.js +19 -0
  88. package/dist/floor-table.data.d.ts.map +1 -1
  89. package/dist/floor-table.data.js +54 -31
  90. package/dist/forge-check/contract.d.ts +11 -1
  91. package/dist/forge-check/contract.d.ts.map +1 -1
  92. package/dist/forge-check/contract.js +4 -1
  93. package/dist/forge-check/index.d.ts +2 -0
  94. package/dist/forge-check/index.d.ts.map +1 -1
  95. package/dist/forge-check/index.js +2 -0
  96. package/dist/gate-resume-run.d.ts +9 -1
  97. package/dist/gate-resume-run.d.ts.map +1 -1
  98. package/dist/gate-resume-run.js +26 -3
  99. package/dist/generated-check.d.ts +18 -4
  100. package/dist/generated-check.d.ts.map +1 -1
  101. package/dist/generated-check.js +37 -5
  102. package/dist/image-pins.d.ts +26 -0
  103. package/dist/image-pins.d.ts.map +1 -0
  104. package/dist/image-pins.js +19 -0
  105. package/dist/lexicon.d.ts +11 -0
  106. package/dist/lexicon.d.ts.map +1 -1
  107. package/dist/lifecycle/git.d.ts +11 -0
  108. package/dist/lifecycle/git.d.ts.map +1 -1
  109. package/dist/lifecycle/git.js +30 -3
  110. package/dist/lifecycle/publish-npm.d.ts +11 -0
  111. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  112. package/dist/lifecycle/publish-npm.js +27 -1
  113. package/dist/lifecycle/reach-locks.d.ts +131 -0
  114. package/dist/lifecycle/reach-locks.d.ts.map +1 -0
  115. package/dist/lifecycle/reach-locks.js +118 -0
  116. package/dist/lifecycle/release-cut.d.ts +3 -1
  117. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  118. package/dist/lifecycle/release-cut.js +15 -0
  119. package/dist/lifecycle/release-images.d.ts.map +1 -1
  120. package/dist/lifecycle/release-images.js +1 -2
  121. package/dist/notify-product.d.ts +12 -3
  122. package/dist/notify-product.d.ts.map +1 -1
  123. package/dist/notify-product.js +10 -6
  124. package/dist/op/activities/source-release.d.ts.map +1 -1
  125. package/dist/op/activities/source-release.js +2 -1
  126. package/dist/op/activities/source-rollback.d.ts.map +1 -1
  127. package/dist/op/activities/source-rollback.js +2 -1
  128. package/dist/op/index.d.ts +2 -0
  129. package/dist/op/index.d.ts.map +1 -1
  130. package/dist/op/index.js +1 -0
  131. package/dist/op/op-waves-evidence-jobs.d.ts +6 -1
  132. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  133. package/dist/op/op-waves-evidence-jobs.js +9 -3
  134. package/dist/op/op-waves-render-spec.d.ts +100 -0
  135. package/dist/op/op-waves-render-spec.d.ts.map +1 -0
  136. package/dist/op/op-waves-render-spec.js +162 -0
  137. package/dist/op/op-waves-run.d.ts +2 -0
  138. package/dist/op/op-waves-run.d.ts.map +1 -1
  139. package/dist/op/op-waves-run.js +2 -1
  140. package/dist/op/op-waves.d.ts +4 -0
  141. package/dist/op/op-waves.d.ts.map +1 -1
  142. package/dist/op/op-waves.js +4 -1
  143. package/dist/op/schedule-overdue.d.ts.map +1 -1
  144. package/dist/op/schedule-overdue.js +59 -3
  145. package/dist/op/wave-stop.d.ts +64 -0
  146. package/dist/op/wave-stop.d.ts.map +1 -0
  147. package/dist/op/wave-stop.js +127 -0
  148. package/dist/planned-files.d.ts +76 -0
  149. package/dist/planned-files.d.ts.map +1 -0
  150. package/dist/planned-files.js +108 -0
  151. package/dist/pr-forge-job.d.ts +22 -0
  152. package/dist/pr-forge-job.d.ts.map +1 -0
  153. package/dist/pr-forge-job.js +46 -0
  154. package/dist/pr-loop.d.ts +3 -6
  155. package/dist/pr-loop.d.ts.map +1 -1
  156. package/dist/pr-loop.js +4 -81
  157. package/dist/pr-plan-note.d.ts +97 -0
  158. package/dist/pr-plan-note.d.ts.map +1 -1
  159. package/dist/pr-plan-note.js +94 -1
  160. package/dist/pr-post.d.ts +28 -3
  161. package/dist/pr-post.d.ts.map +1 -1
  162. package/dist/pr-post.js +145 -13
  163. package/dist/pr-status.d.ts +16 -0
  164. package/dist/pr-status.d.ts.map +1 -0
  165. package/dist/pr-status.js +90 -0
  166. package/dist/ref-gate-init.d.ts +16 -2
  167. package/dist/ref-gate-init.d.ts.map +1 -1
  168. package/dist/ref-gate-init.js +24 -13
  169. package/dist/release-floors.d.ts +37 -1
  170. package/dist/release-floors.d.ts.map +1 -1
  171. package/dist/release-floors.js +61 -25
  172. package/dist/render-module.d.ts +15 -0
  173. package/dist/render-module.d.ts.map +1 -0
  174. package/dist/render-module.js +73 -0
  175. package/dist/state-migration.d.ts.map +1 -1
  176. package/dist/state-migration.js +1 -2
  177. package/dist/wave-runtime.mjs +304 -301
  178. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  179. package/dist/workspace/ci-green-cli.js +3 -2
  180. package/dist/workspace/release-train.d.ts.map +1 -1
  181. package/dist/workspace/release-train.js +2 -1
  182. package/dist/workspace/release-workflow.d.ts +4 -3
  183. package/dist/workspace/release-workflow.d.ts.map +1 -1
  184. package/dist/workspace/release-workflow.js +10 -7
  185. package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
  186. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  187. package/dist/workspace/trust/check-evidence-report.js +15 -8
  188. package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
  189. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  190. package/dist/workspace/trust/ref-gate-cli.js +30 -10
  191. package/dist/workspace/workspace-run.d.ts.map +1 -1
  192. package/dist/workspace/workspace-run.js +2 -1
  193. package/package.json +1 -1
  194. package/src/actor.test.ts +68 -2
  195. package/src/actor.ts +61 -1
  196. package/src/chant-install.test.ts +2 -3
  197. package/src/chant-install.ts +1 -2
  198. package/src/ci-base.test.ts +41 -0
  199. package/src/ci-base.ts +43 -0
  200. package/src/ci-comment-commands.test.ts +376 -0
  201. package/src/ci-comment-commands.ts +389 -0
  202. package/src/ci-comment-replies.ts +78 -0
  203. package/src/ci-commit.test.ts +2 -3
  204. package/src/ci-evidence-from-job.test.ts +18 -0
  205. package/src/ci-evidence-from-job.ts +58 -2
  206. package/src/ci-evidence-jobs.ts +50 -5
  207. package/src/ci-image.test.ts +130 -9
  208. package/src/ci-image.ts +85 -12
  209. package/src/ci-note-commands.ts +104 -41
  210. package/src/ci-product-words.ts +59 -0
  211. package/src/ci-product.ts +40 -4
  212. package/src/cli/commands/build.test.ts +41 -0
  213. package/src/cli/commands/build.ts +27 -2
  214. package/src/cli/handlers/approve.ts +2 -1
  215. package/src/cli/handlers/ci-check.ts +19 -7
  216. package/src/cli/handlers/ci-evidence.ts +29 -8
  217. package/src/cli/handlers/components.ts +3 -1
  218. package/src/cli/handlers/generated-check.ts +31 -1
  219. package/src/cli/handlers/lock-reach.test.ts +103 -0
  220. package/src/cli/handlers/lock.ts +100 -4
  221. package/src/cli/handlers/pr-comment.ts +104 -0
  222. package/src/cli/handlers/pr-env.ts +6 -3
  223. package/src/cli/handlers/pr-record.test.ts +1 -1
  224. package/src/cli/handlers/pr.ts +50 -10
  225. package/src/cli/handlers/promote.ts +2 -1
  226. package/src/cli/handlers/release.e2e.test.ts +35 -0
  227. package/src/cli/handlers/release.ts +14 -2
  228. package/src/cli/handlers/run-wave.ts +28 -2
  229. package/src/cli/handlers/run.ts +2 -1
  230. package/src/cli/main.ts +24 -2
  231. package/src/cli/parse-args.ts +12 -0
  232. package/src/cli/registry.ts +11 -0
  233. package/src/components/auto-release.ts +2 -1
  234. package/src/components/pr-checks.ts +112 -17
  235. package/src/components/pr-pipeline.ts +17 -15
  236. package/src/components/product-pipeline.ts +93 -11
  237. package/src/components/product-plan.test.ts +40 -2
  238. package/src/components/product-plan.ts +331 -45
  239. package/src/drift-record.test.ts +20 -0
  240. package/src/drift-record.ts +16 -0
  241. package/src/floor-table.data.ts +54 -31
  242. package/src/forge-check/contract.ts +12 -1
  243. package/src/forge-check/forge-check.test.ts +17 -0
  244. package/src/forge-check/index.ts +2 -0
  245. package/src/gate-resume-run.ts +27 -3
  246. package/src/generated-check.e2e.test.ts +21 -1
  247. package/src/generated-check.test.ts +66 -0
  248. package/src/generated-check.ts +51 -10
  249. package/src/image-pins.ts +31 -0
  250. package/src/lexicon.ts +11 -0
  251. package/src/lifecycle/git.test.ts +48 -0
  252. package/src/lifecycle/git.ts +27 -4
  253. package/src/lifecycle/publish-npm.ts +31 -1
  254. package/src/lifecycle/reach-locks.test.ts +87 -0
  255. package/src/lifecycle/reach-locks.ts +169 -0
  256. package/src/lifecycle/release-cut.ts +17 -1
  257. package/src/lifecycle/release-images.test.ts +56 -0
  258. package/src/lifecycle/release-images.ts +1 -2
  259. package/src/notify-product.ts +19 -8
  260. package/src/op/activities/source-release.ts +2 -1
  261. package/src/op/activities/source-rollback.ts +2 -1
  262. package/src/op/gate-resume.test.ts +27 -0
  263. package/src/op/index.ts +10 -0
  264. package/src/op/op-waves-evidence-jobs.ts +10 -4
  265. package/src/op/op-waves-notify-words.test.ts +18 -0
  266. package/src/op/op-waves-render-spec.test.ts +160 -0
  267. package/src/op/op-waves-render-spec.ts +171 -0
  268. package/src/op/op-waves-run.ts +2 -1
  269. package/src/op/op-waves.ts +5 -2
  270. package/src/op/schedule-overdue.test.ts +43 -0
  271. package/src/op/schedule-overdue.ts +57 -3
  272. package/src/op/wave-stop.test.ts +72 -0
  273. package/src/op/wave-stop.ts +137 -0
  274. package/src/planned-files.test.ts +80 -0
  275. package/src/planned-files.ts +134 -0
  276. package/src/pr-forge-job.test.ts +53 -0
  277. package/src/pr-forge-job.ts +46 -0
  278. package/src/pr-loop-narrowed.test.ts +2 -1
  279. package/src/pr-loop-words.test.ts +2 -1
  280. package/src/pr-loop.test.ts +1 -2
  281. package/src/pr-loop.ts +4 -80
  282. package/src/pr-plan-note.ts +155 -3
  283. package/src/pr-post-replan.test.ts +144 -0
  284. package/src/pr-post-subject.test.ts +230 -0
  285. package/src/pr-post.test.ts +2 -1
  286. package/src/pr-post.ts +150 -15
  287. package/src/pr-status.ts +91 -0
  288. package/src/ref-gate-init.ts +30 -11
  289. package/src/release-floors.ts +78 -25
  290. package/src/render-module.ts +73 -0
  291. package/src/state-migration-record.test.ts +2 -3
  292. package/src/state-migration.ts +1 -2
  293. package/src/workspace/ci-green-cli.ts +3 -2
  294. package/src/workspace/ci-green-workflow.test.ts +32 -1
  295. package/src/workspace/release-train.ts +2 -1
  296. package/src/workspace/release-workflow.test.ts +36 -5
  297. package/src/workspace/release-workflow.ts +10 -7
  298. package/src/workspace/trust/check-evidence-report.ts +15 -8
  299. package/src/workspace/trust/check-evidence.test.ts +5 -0
  300. package/src/workspace/trust/ref-gate-cli.ts +30 -8
  301. package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
  302. package/src/workspace/trust/ref-gate.test.ts +10 -0
  303. package/src/workspace/workspace-run.ts +2 -1
@@ -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
  }
@@ -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); {@link installCiTool} does the same from Node, for a product
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, act) needs a recorded sha256. An
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";
@@ -1 +1 @@
1
- {"version":3,"file":"ci-image.d.ts","sourceRoot":"","sources":["../src/ci-image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AASH,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEzG,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,uBAAuB,EAAE,CAAC;AAKjF,MAAM,MAAM,MAAM,GACd,MAAM,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,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); {@link installCiTool} does the same from Node, for a product
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, act) needs a recorded sha256. An
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
- `curl -fsSLo "$t/$f" "${base}/$f"`,
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(`curl -fsSLo "$t/sums" ${options.checksumsUrl ?? `"${base}/${checksums}"`}`,
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(`unzip -q -o "$t/$f" "${member}" -d "$t"`, `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
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(`unzip -q "$t/$f" -d "$t"`, `${su}"$t/aws/install" -i "${dir}" -b "${dir}/bin"`);
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
- /** What a command runs in chant's own GitLab pipeline, for the jobs it has. */
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,EAA6C,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/H,OAAO,EAAkC,KAAK,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAuB,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,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B,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8FAA8F;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"}
@@ -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
- return retry(o, mr, note.author, run, reply, broke);
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
- async function retry(o, mr, user, run, reply, broke) {
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 iid = mr.number;
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 pipeline at the merge commit ${short(sha)} of !${iid} has an apply job, so there is nothing to retry; push to ${o.base} again`);
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 broke(`could not read the pipelines at ${short(sha)} (${message(e)})`);
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 broke(`could not read the statuses of ${short(c)} (${message(e)})`);
263
+ return { kind: "fail", reason: `could not read the statuses of ${short(c)} (${message(e)})` };
248
264
  }
249
265
  if (applied) {
250
- const at = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
251
- return reply(`a later apply already ran on ${o.base} at ${short(c)}${at}, so the merge commit ${short(sha)} of !${iid} is not applied: comment on the merge request that commit came from, or push again`);
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
- const order = (j) => {
255
- const m = pattern.exec(j.name);
256
- return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
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
- /** What a command runs in chant's own GitLab pipeline, for the jobs it has. */
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) => `\`/${words.product} ${Object.entries(words.commands).find(([, c]) => c === kind)?.[0] ?? 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: `a merge request from a fork runs no command: its code never runs with this project's credentials` };
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: `${line(parsed.kind)} does not run here: this project takes no locks` };
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: `the agent command is off in this project` };
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)