@intentius/chant 0.124.88 → 0.124.90
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 +193 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +353 -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-job-guard.d.ts +42 -45
- package/dist/ci-job-guard.d.ts.map +1 -1
- package/dist/ci-job-guard.js +206 -3
- package/dist/ci-note-commands.d.ts +104 -4
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +131 -38
- 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 +72 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +73 -6
- 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 +33 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +201 -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-notes.d.ts.map +1 -1
- package/dist/cli/handlers/pr-notes.js +23 -1
- 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 +71 -23
- 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 +180 -4
- 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 +41 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +31 -0
- package/dist/cli/registry.d.ts +19 -1
- 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 +97 -6
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +107 -13
- package/dist/components/pr-pipeline.d.ts +19 -14
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +7 -13
- package/dist/components/product-pipeline.d.ts +96 -3
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +120 -14
- package/dist/components/product-plan.d.ts +203 -6
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +250 -43
- 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 +63 -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 +93 -4
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-applied.d.ts +9 -0
- package/dist/lifecycle/gate-applied.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/apply-status.d.ts +84 -0
- package/dist/op/apply-status.d.ts.map +1 -0
- package/dist/op/apply-status.js +106 -0
- package/dist/op/before-merge-decide.d.ts +102 -0
- package/dist/op/before-merge-decide.d.ts.map +1 -0
- package/dist/op/before-merge-decide.js +142 -0
- package/dist/op/before-merge-done.d.ts +56 -0
- package/dist/op/before-merge-done.d.ts.map +1 -0
- package/dist/op/before-merge-done.js +69 -0
- package/dist/op/before-merge-store.d.ts +20 -0
- package/dist/op/before-merge-store.d.ts.map +1 -0
- package/dist/op/before-merge-store.js +48 -0
- package/dist/op/before-merge.d.ts +150 -0
- package/dist/op/before-merge.d.ts.map +1 -0
- package/dist/op/before-merge.js +207 -0
- package/dist/op/follow-on-run.d.ts +117 -0
- package/dist/op/follow-on-run.d.ts.map +1 -0
- package/dist/op/follow-on-run.js +154 -0
- package/dist/op/follow-on-store.d.ts +17 -0
- package/dist/op/follow-on-store.d.ts.map +1 -0
- package/dist/op/follow-on-store.js +54 -0
- package/dist/op/gate.d.ts +6 -0
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +10 -1
- package/dist/op/index.d.ts +5 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +2 -0
- package/dist/op/op-waves-after-plan.d.ts +13 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.d.ts +10 -2
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +19 -5
- package/dist/op/op-waves-follow-on.d.ts +162 -0
- package/dist/op/op-waves-follow-on.d.ts.map +1 -0
- package/dist/op/op-waves-follow-on.js +355 -0
- 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 +148 -6
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +873 -100
- package/dist/op/op-waves-split.d.ts +122 -0
- package/dist/op/op-waves-split.d.ts.map +1 -0
- package/dist/op/op-waves-split.js +166 -0
- package/dist/op/op-waves.d.ts +24 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +18 -1
- package/dist/op/schedule-overdue.d.ts +15 -1
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +77 -5
- package/dist/op/stage-hooks.d.ts +36 -1
- package/dist/op/stage-hooks.d.ts.map +1 -1
- package/dist/op/stage-hooks.js +17 -3
- package/dist/op/wave-stop.d.ts +67 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +129 -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 +146 -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 +39 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +63 -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-blocked.d.ts +7 -1
- package/dist/wave-blocked.d.ts.map +1 -1
- package/dist/wave-blocked.js +7 -2
- package/dist/wave-runtime.mjs +366 -350
- 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 +439 -0
- package/src/ci-comment-commands.ts +428 -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 -10
- package/src/ci-image.ts +85 -12
- package/src/ci-job-guard.before-merge.test.ts +148 -0
- package/src/ci-job-guard.follow-on-record.test.ts +137 -0
- package/src/ci-job-guard.follow-on.test.ts +144 -0
- package/src/ci-job-guard.ts +221 -3
- package/src/ci-note-commands.test.ts +76 -1
- package/src/ci-note-commands.ts +198 -46
- package/src/ci-product-words.ts +59 -0
- package/src/ci-product.ts +90 -6
- 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 +187 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-notes.ts +30 -6
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +64 -21
- 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 +170 -4
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +41 -2
- package/src/cli/parse-args.ts +23 -0
- package/src/cli/registry.ts +19 -1
- package/src/components/auto-release.ts +2 -1
- package/src/components/pr-checks.ts +165 -17
- package/src/components/pr-pipeline.ts +22 -18
- package/src/components/product-pipeline.apply-status.test.ts +50 -0
- package/src/components/product-pipeline.ts +204 -17
- package/src/components/product-plan.test.ts +60 -4
- package/src/components/product-plan.ts +367 -50
- package/src/drift-record.test.ts +20 -0
- package/src/drift-record.ts +16 -0
- package/src/floor-table.data.ts +63 -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 +89 -1
- package/src/lifecycle/gate-applied.ts +7 -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/apply-status.test.ts +83 -0
- package/src/op/apply-status.ts +132 -0
- package/src/op/before-merge-decide.ts +190 -0
- package/src/op/before-merge-done.ts +99 -0
- package/src/op/before-merge-store.ts +44 -0
- package/src/op/before-merge.test.ts +201 -0
- package/src/op/before-merge.ts +266 -0
- package/src/op/follow-on-run.ts +206 -0
- package/src/op/follow-on-store.ts +54 -0
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/gate.ts +16 -1
- package/src/op/index.ts +15 -0
- package/src/op/op-waves-after-plan.ts +13 -0
- package/src/op/op-waves-evidence-jobs.ts +21 -7
- package/src/op/op-waves-follow-on-record.test.ts +152 -0
- package/src/op/op-waves-follow-on.test.ts +247 -0
- package/src/op/op-waves-follow-on.ts +385 -0
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +159 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +973 -94
- package/src/op/op-waves-split-product.test.ts +288 -0
- package/src/op/op-waves-split-step.test.ts +298 -0
- package/src/op/op-waves-split.test.ts +196 -0
- package/src/op/op-waves-split.ts +189 -0
- package/src/op/op-waves.ts +31 -3
- package/src/op/schedule-overdue.test.ts +72 -1
- package/src/op/schedule-overdue.ts +84 -6
- package/src/op/stage-hooks.ts +52 -4
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +139 -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 +151 -15
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +30 -11
- package/src/release-floors.ts +81 -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/wave-blocked.ts +9 -4
- 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/src/ci-note-commands.ts
CHANGED
|
@@ -29,10 +29,12 @@
|
|
|
29
29
|
|
|
30
30
|
import { GITLAB_AGENT_ASK_VAR, GITLAB_AGENT_PR_VAR } from "./ci-agent";
|
|
31
31
|
import { GITLAB_COMMIT_ARG_VAR, GITLAB_COMMIT_PR_VAR, GITLAB_COMMIT_WORD_VAR } from "./ci-commit";
|
|
32
|
-
import { parseProductComment, productStatusContext, type CiProductWords, type ParsedProductComment } from "./ci-product-words";
|
|
32
|
+
import { parseProductComment, productStatusContext, type CiProductCommand, type CiProductWords, type ParsedProductComment } from "./ci-product-words";
|
|
33
|
+
import { commandLine, commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-replies";
|
|
33
34
|
import { GITLAB_APPLY_PR_VAR, GITLAB_LOCK_PR_VAR, GITLAB_PREVIEW_PR_VAR, GITLAB_UNLOCK_PR_VAR, PREVIEW_COMMENT_ENV } from "./components/pr-pipeline";
|
|
34
|
-
import { ForgeApiError, type ForgeFetch, type GitlabForgeOptions, type PrForge } from "./pr-forge";
|
|
35
|
+
import { ForgeApiError, type ForgeFetch, type ForgeKind, type GitlabForgeOptions, type PrForge } from "./pr-forge";
|
|
35
36
|
import type { ForgeReads, PullRequestDetail, PullRequestNote, RunJob, WorkflowRun } from "./pr-forge-reads";
|
|
37
|
+
import type { DecideBeforeMergeInput, WavesBeforeMergeJobs } from "./op/before-merge-decide";
|
|
36
38
|
|
|
37
39
|
export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline";
|
|
38
40
|
|
|
@@ -118,7 +120,17 @@ export type NoteRun =
|
|
|
118
120
|
* that has such a job. Refused when a later commit of the default branch
|
|
119
121
|
* already carries the product's apply status.
|
|
120
122
|
*/
|
|
121
|
-
| {
|
|
123
|
+
| {
|
|
124
|
+
kind: "retry";
|
|
125
|
+
sha: string;
|
|
126
|
+
jobs?: RegExp;
|
|
127
|
+
/**
|
|
128
|
+
* With the waves' op (#4984, the GitLab half of #4979's stop): the
|
|
129
|
+
* stop written for `sha` on `chant/lifecycle` just before the retry,
|
|
130
|
+
* the last wave that runs, or null to clear an earlier one.
|
|
131
|
+
*/
|
|
132
|
+
stop?: { op: string; through: number | null };
|
|
133
|
+
}
|
|
122
134
|
/** A reply, and nothing runs. */
|
|
123
135
|
| { kind: "reply"; text: string }
|
|
124
136
|
/** Something broke: the note gets no reply and is read again next poll. */
|
|
@@ -183,6 +195,8 @@ export interface NoteCommandsOptions {
|
|
|
183
195
|
env?: Record<string, string | undefined>;
|
|
184
196
|
/** The commit words that take an argument, as `parseProductComment` takes them. */
|
|
185
197
|
commitArgs?: Readonly<Record<string, RegExp>>;
|
|
198
|
+
/** Writes a retry's wave stop for op `op` at `sha`, or clears it (#4984). Absent: a retry that carries a stop is refused. */
|
|
199
|
+
stops?: (op: string, sha: string, stop: { through: number; at: string; by?: string; pr?: number } | null) => Promise<void>;
|
|
186
200
|
}
|
|
187
201
|
|
|
188
202
|
export interface NotePoll {
|
|
@@ -304,8 +318,29 @@ async function answer(o: NoteCommandsOptions, mr: PullRequestDetail, note: PullR
|
|
|
304
318
|
}
|
|
305
319
|
return reply(`started pipeline${link(started)} to ${run.doing} for ${note.author}`, true, started.url);
|
|
306
320
|
}
|
|
307
|
-
case "retry":
|
|
308
|
-
|
|
321
|
+
case "retry": {
|
|
322
|
+
// #4984: the stop goes on chant/lifecycle just before the retry, so every wave job after it reads it.
|
|
323
|
+
const stop = run.stop;
|
|
324
|
+
if (stop && !o.stops) return broke("the retry carries a wave stop, and this poll cannot write one");
|
|
325
|
+
const retry = gitlabRetry(o.pipelines);
|
|
326
|
+
const author = note.author;
|
|
327
|
+
const rerun: ApplyRerun = stop
|
|
328
|
+
? async (pipeline, jobs, ctx) => {
|
|
329
|
+
try {
|
|
330
|
+
await o.stops!(stop.op, run.sha, stop.through === null ? null : { through: stop.through, at, by: author, pr: mr.number });
|
|
331
|
+
} catch (e) {
|
|
332
|
+
return { kind: "fail", reason: `could not write the wave stop for ${short(run.sha)}, so nothing was retried (${message(e)})` };
|
|
333
|
+
}
|
|
334
|
+
return retry(pipeline, jobs, ctx);
|
|
335
|
+
}
|
|
336
|
+
: retry;
|
|
337
|
+
const done = await retryApply(o, "gitlab", mr, note.author, run, rerun);
|
|
338
|
+
if (done.kind === "ran" && stop?.through !== null && stop?.through !== undefined) {
|
|
339
|
+
return reply(`${done.text}; it stops after \`wave-${stop.through}\`, and the waves after it wait until ${commandLine(o.words, "apply")} runs it again`, true, done.url);
|
|
340
|
+
}
|
|
341
|
+
if (done.kind === "fail") return broke(done.reason);
|
|
342
|
+
return reply(done.text, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
|
|
343
|
+
}
|
|
309
344
|
}
|
|
310
345
|
}
|
|
311
346
|
|
|
@@ -314,17 +349,53 @@ export const APPLY_JOBS = /^(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(
|
|
|
314
349
|
|
|
315
350
|
const NOT_DONE = new Set(["created", "pending", "running", "waiting_for_resource", "preparing", "scheduled"]);
|
|
316
351
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
352
|
+
/** What starting a merge commit's apply again came to: a reply alone, a run started (`ran`), or a forge answer that broke it. */
|
|
353
|
+
export type ApplyRetried = { kind: "reply"; text: string } | { kind: "ran"; text: string; url?: string } | { kind: "fail"; reason: string };
|
|
354
|
+
|
|
355
|
+
/** What {@link ApplyRerun} is told: the merge commit, the pull request's name in a reply, who asked, and the default branch. */
|
|
356
|
+
export interface ApplyRerunContext {
|
|
357
|
+
sha: string;
|
|
358
|
+
/** `!12`, or `pull request 12`. */
|
|
359
|
+
at: string;
|
|
360
|
+
user: string;
|
|
361
|
+
base: string;
|
|
362
|
+
/** The pattern the apply jobs matched, whose groups are the wave and the share. */
|
|
363
|
+
pattern: RegExp;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* How a forge starts a merge commit's apply again (#4946), once
|
|
368
|
+
* {@link retryApply} found the push run at the commit with apply jobs and no
|
|
369
|
+
* later apply. GitLab retries the first apply job that did not succeed
|
|
370
|
+
* ({@link gitlabRetry}); GitHub and Forgejo answer in ./ci-comment-commands.ts.
|
|
371
|
+
*/
|
|
372
|
+
export type ApplyRerun = (run: WorkflowRun, jobs: RunJob[], c: ApplyRerunContext) => Promise<ApplyRetried>;
|
|
373
|
+
|
|
374
|
+
/** What {@link retryApply} reads with. */
|
|
375
|
+
export interface ApplyRetryReads {
|
|
376
|
+
reads: ForgeReads;
|
|
377
|
+
/** chant's client: it reads the later commits' statuses. */
|
|
378
|
+
forge: Pick<PrForge, "commitStatuses">;
|
|
379
|
+
words: CiProductWords;
|
|
380
|
+
/** The default branch. */
|
|
381
|
+
base: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Start a merged pull request's apply again (#4785; shared with GitHub and
|
|
386
|
+
* Forgejo in #4946): the newest push run at the merge commit that has an
|
|
387
|
+
* apply job, refused when a later commit of the default branch already
|
|
388
|
+
* carries the product's apply status, since going back to this one would
|
|
389
|
+
* undo it. `rerun` is the forge's own start.
|
|
390
|
+
*/
|
|
391
|
+
export async function retryApply(o: ApplyRetryReads, forgeKind: ForgeKind, mr: PullRequestDetail, user: string, run: Extract<NoteRun, { kind: "retry" }>, rerun: ApplyRerun): Promise<ApplyRetried> {
|
|
325
392
|
const { sha } = run;
|
|
326
393
|
const pattern = run.jobs ?? APPLY_JOBS;
|
|
327
|
-
const
|
|
394
|
+
const t = commentTerms(forgeKind);
|
|
395
|
+
const at = t.at(mr.number);
|
|
396
|
+
const gitlab = forgeKind === "gitlab";
|
|
397
|
+
const runWord = gitlab ? "pipeline" : "workflow run";
|
|
398
|
+
const reply = (text: string): ApplyRetried => ({ kind: "reply", text });
|
|
328
399
|
// The newest push pipeline at the merge commit with an apply job: a branch pipeline, or a ci/green tag's.
|
|
329
400
|
let pipeline: WorkflowRun | undefined;
|
|
330
401
|
let jobs: RunJob[] = [];
|
|
@@ -338,10 +409,10 @@ async function retry(
|
|
|
338
409
|
break;
|
|
339
410
|
}
|
|
340
411
|
}
|
|
341
|
-
if (!pipeline) return reply(`no
|
|
412
|
+
if (!pipeline) 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`);
|
|
342
413
|
newer = await o.reads.branchRuns(o.base, { event: "push", limit: NOTE_COMMANDS_NEWER_PIPELINES });
|
|
343
414
|
} catch (e) {
|
|
344
|
-
return
|
|
415
|
+
return { kind: "fail", reason: `could not read the ${runWord}s at ${short(sha)} (${message(e)})` };
|
|
345
416
|
}
|
|
346
417
|
// A later commit whose apply started applied a newer tree: going back to this one would undo it.
|
|
347
418
|
const applyContext = productStatusContext(o.words, "apply");
|
|
@@ -351,32 +422,40 @@ async function retry(
|
|
|
351
422
|
try {
|
|
352
423
|
applied = (await o.forge.commitStatuses?.(c))?.find((s) => s.context === applyContext);
|
|
353
424
|
} catch (e) {
|
|
354
|
-
return
|
|
425
|
+
return { kind: "fail", reason: `could not read the statuses of ${short(c)} (${message(e)})` };
|
|
355
426
|
}
|
|
356
427
|
if (applied) {
|
|
357
|
-
const
|
|
358
|
-
return reply(`a later apply already ran on ${o.base} at ${short(c)}${
|
|
428
|
+
const link = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
|
|
429
|
+
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`);
|
|
359
430
|
}
|
|
360
431
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
432
|
+
return rerun(pipeline, jobs, { sha, at, user, base: o.base, pattern });
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
|
|
436
|
+
export function gitlabRetry(pipelines: Pick<GitlabPipelines, "retryJob">): ApplyRerun {
|
|
437
|
+
return async (pipeline, jobs, { sha, at, user, base, pattern }) => {
|
|
438
|
+
const reply = (text: string): ApplyRetried => ({ kind: "reply", text });
|
|
439
|
+
const order = (j: RunJob): [number, number] => {
|
|
440
|
+
const m = pattern.exec(j.name);
|
|
441
|
+
return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
|
|
442
|
+
};
|
|
443
|
+
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
444
|
+
const next = sorted.find((j) => j.status !== "success");
|
|
445
|
+
if (!next) return reply(`every apply job of ${at}'s merge commit ${short(sha)} already succeeded`);
|
|
446
|
+
if (NOT_DONE.has(next.status)) return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
447
|
+
if (next.status !== "failed" && next.status !== "canceled") {
|
|
448
|
+
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${base} again`);
|
|
449
|
+
}
|
|
450
|
+
let retried: StartedRun;
|
|
451
|
+
try {
|
|
452
|
+
retried = await pipelines.retryJob(next.id);
|
|
453
|
+
} catch (e) {
|
|
454
|
+
return { kind: "fail", reason: `could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})` };
|
|
455
|
+
}
|
|
456
|
+
const link = retried.url ? ` (${retried.url})` : "";
|
|
457
|
+
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 } : {}) };
|
|
364
458
|
};
|
|
365
|
-
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
366
|
-
const next = sorted.find((j) => j.status !== "success");
|
|
367
|
-
if (!next) return reply(`every apply job of !${iid}'s merge commit ${short(sha)} already succeeded`);
|
|
368
|
-
if (NOT_DONE.has(next.status)) return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
369
|
-
if (next.status !== "failed" && next.status !== "canceled") {
|
|
370
|
-
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${o.base} again`);
|
|
371
|
-
}
|
|
372
|
-
let retried: StartedRun;
|
|
373
|
-
try {
|
|
374
|
-
retried = await o.pipelines.retryJob(next.id);
|
|
375
|
-
} catch (e) {
|
|
376
|
-
return broke(`could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})`);
|
|
377
|
-
}
|
|
378
|
-
const link = retried.url ? ` (${retried.url})` : "";
|
|
379
|
-
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);
|
|
380
459
|
}
|
|
381
460
|
|
|
382
461
|
/** The jobs chant's GitLab pipeline has, which {@link chantNoteRuns} starts. */
|
|
@@ -393,17 +472,53 @@ export interface ChantNoteJobs {
|
|
|
393
472
|
agent?: boolean;
|
|
394
473
|
/** The commit jobs, started with `CHANT_COMMIT_PR`, `CHANT_COMMIT` and `CHANT_COMMIT_ARG`. */
|
|
395
474
|
commits?: boolean;
|
|
475
|
+
/**
|
|
476
|
+
* The members the pipeline was written with (#4946), such as terragucci's
|
|
477
|
+
* roots: a plan or an action naming any other gets the words' `member`
|
|
478
|
+
* reply, and nothing starts. Absent: any member a comment may name.
|
|
479
|
+
*/
|
|
480
|
+
members?: readonly string[];
|
|
481
|
+
/**
|
|
482
|
+
* The waves on merge (#4984, as the comment job's #4979): their op and
|
|
483
|
+
* count. With them a merged merge request's `wave-<n>` writes a stop for
|
|
484
|
+
* the merge commit before the retry, and an apply without a wave clears
|
|
485
|
+
* it; without them a `wave-<n>` is refused, as before.
|
|
486
|
+
*/
|
|
487
|
+
waves?: { op: string; count: number };
|
|
488
|
+
/**
|
|
489
|
+
* The waves before merge (#4984), with `waves`: an open merge request's
|
|
490
|
+
* apply is decided here (./op/before-merge-decide.ts), recorded on
|
|
491
|
+
* `chant/lifecycle`, and runs in a pipeline of the default branch started
|
|
492
|
+
* with `CHANT_BEFORE_MERGE_PR`, `CHANT_BEFORE_MERGE_HEAD` and
|
|
493
|
+
* `CHANT_BEFORE_MERGE_DIGEST`.
|
|
494
|
+
*/
|
|
495
|
+
wavesBeforeMerge?: WavesBeforeMergeJobs;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/** What {@link chantNoteRuns} reads and writes with besides the jobs (#4984). */
|
|
499
|
+
export interface ChantNoteRunsOptions {
|
|
500
|
+
/** With `jobs.wavesBeforeMerge`: what the decision before merge reads and writes with. */
|
|
501
|
+
beforeMerge?: Pick<DecideBeforeMergeInput, "requires" | "statuses" | "git" | "cwd" | "lock" | "record" | "stop" | "now">;
|
|
396
502
|
}
|
|
397
503
|
|
|
398
|
-
/**
|
|
399
|
-
|
|
400
|
-
|
|
504
|
+
/**
|
|
505
|
+
* What a command runs in chant's own GitLab pipeline, for the jobs it has.
|
|
506
|
+
* A command no job runs gets the words' reply for it (`words.replies`,
|
|
507
|
+
* #4946), else chant's.
|
|
508
|
+
*/
|
|
509
|
+
export function chantNoteRuns(jobs: ChantNoteJobs, opts: ChantNoteRunsOptions = {}): NoteCommandRuns {
|
|
510
|
+
return ({ mr, note, parsed, base, words }): NoteRun | Promise<NoteRun> => {
|
|
401
511
|
const iid = String(mr.number);
|
|
402
512
|
const at = `!${mr.number}`;
|
|
403
|
-
const line = (kind:
|
|
404
|
-
|
|
513
|
+
const line = (kind: CiProductCommand): string => commandLine(words, kind);
|
|
514
|
+
// #4946: a member outside the pipeline's is refused before anything starts, a fork's included.
|
|
515
|
+
const member = parsed.kind === "plan" || parsed.kind === "action" ? parsed.member : undefined;
|
|
516
|
+
if (member !== undefined && jobs.members && !jobs.members.includes(member)) return { kind: "reply", text: memberReply(words, member, jobs.members, "gitlab") };
|
|
517
|
+
if (!mr.sameRepo) return { kind: "reply", text: forkReply(words, "gitlab") };
|
|
405
518
|
const open = mr.state === "open";
|
|
406
519
|
const intoBase = mr.base === undefined || mr.base === base;
|
|
520
|
+
// #4946: the product's sentence for an apply no job answers, in place of chant's, which say what the merge does.
|
|
521
|
+
if (parsed.kind === "apply" && !jobs.applyBeforeMerge && !jobs.applyOnMerge && !jobs.wavesBeforeMerge && words.replies?.apply !== undefined) return { kind: "reply", text: words.replies.apply };
|
|
407
522
|
switch (parsed.kind) {
|
|
408
523
|
case "plan":
|
|
409
524
|
if (!open) return { kind: "reply", text: `${at} is not open, so it is not ${words.verbs.plan[1]}` };
|
|
@@ -411,6 +526,8 @@ export function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns {
|
|
|
411
526
|
return { kind: "merge-request-pipeline", doing: `${words.verbs.plan[0]} ${at} again` };
|
|
412
527
|
case "apply":
|
|
413
528
|
if (open) {
|
|
529
|
+
// #4984: the waves before merge decide here, and the pipeline they start runs the decided head.
|
|
530
|
+
if (jobs.wavesBeforeMerge && jobs.waves && opts.beforeMerge && !jobs.applyBeforeMerge) return wavesBeforeMergeRun(jobs, opts.beforeMerge, { mr, note, parsed, base, words });
|
|
414
531
|
if (!jobs.applyBeforeMerge) return { kind: "reply", text: `${at} is not merged, and this project ${words.verbs.apply[0]}s after a merge request merges, never from its branch` };
|
|
415
532
|
if (!intoBase) return { kind: "reply", text: `${at} targets ${mr.base}, not the default branch ${base}, so it is not ${words.verbs.apply[1]}` };
|
|
416
533
|
return { kind: "pipeline", ref: base, variables: { [GITLAB_APPLY_PR_VAR]: iid }, doing: `${words.verbs.apply[0]} ${at}'s head${mr.headSha ? ` ${short(mr.headSha)}` : ""}` };
|
|
@@ -419,17 +536,19 @@ export function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns {
|
|
|
419
536
|
if (!jobs.applyOnMerge) {
|
|
420
537
|
return { kind: "reply", text: jobs.applyBeforeMerge ? `${at} is merged, and this project ${words.verbs.apply[0]}s a merge request before it merges, so there is nothing of it left to ${words.verbs.apply[0]}` : `${at} is merged, and a merge here records the plan: a release deploys it` };
|
|
421
538
|
}
|
|
422
|
-
|
|
539
|
+
// #4984: with the waves' op, a wave-<n> writes a stop for the merge commit before the retry, as on GitHub and Forgejo.
|
|
540
|
+
if (parsed.wave !== undefined && !jobs.waves) return { kind: "reply", text: `GitLab runs the waves after a retried apply job by itself, so \`wave-${parsed.wave}\` cannot stop them; write ${line("apply")}, and each wave still waits behind its own gate` };
|
|
541
|
+
if (parsed.wave !== undefined && jobs.waves && parsed.wave > jobs.waves.count) return { kind: "reply", text: `the ${words.verbs.apply[0]} of this project runs in ${jobs.waves.count} wave${jobs.waves.count === 1 ? "" : "s"}, so there is no \`wave-${parsed.wave}\`` };
|
|
423
542
|
if (!intoBase) return { kind: "reply", text: `${at} was merged into ${mr.base}, not the default branch ${base}, so nothing applies from it` };
|
|
424
543
|
if (!mr.mergeCommit) return { kind: "fail", reason: `${at} has no merge commit` };
|
|
425
|
-
return { kind: "retry", sha: mr.mergeCommit };
|
|
544
|
+
return { kind: "retry", sha: mr.mergeCommit, ...(jobs.waves ? { stop: { op: jobs.waves.op, through: parsed.wave !== undefined && parsed.wave < jobs.waves.count ? parsed.wave : null } } : {}) };
|
|
426
545
|
case "lock":
|
|
427
546
|
case "unlock":
|
|
428
|
-
if (!jobs.locks) return { kind: "reply", text:
|
|
547
|
+
if (!jobs.locks) return { kind: "reply", text: notRunReply(words, parsed.kind, "gitlab") };
|
|
429
548
|
if (parsed.kind === "lock" && !open) return { kind: "reply", text: `${at} is not open, so it takes no lock` };
|
|
430
549
|
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}` };
|
|
431
550
|
case "agent":
|
|
432
|
-
if (!jobs.agent) return { kind: "reply", text:
|
|
551
|
+
if (!jobs.agent) return { kind: "reply", text: notRunReply(words, "agent", "gitlab") };
|
|
433
552
|
if (!open) return { kind: "reply", text: `${at} is not open, so the agent does not run` };
|
|
434
553
|
if (mr.head === base) return { kind: "reply", text: `${at}'s source branch is the default branch, and an agent never pushes there` };
|
|
435
554
|
return { kind: "pipeline", ref: base, variables: { [GITLAB_AGENT_PR_VAR]: iid, [GITLAB_AGENT_ASK_VAR]: parsed.ask }, doing: `run the agent on ${at}` };
|
|
@@ -443,6 +562,39 @@ export function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns {
|
|
|
443
562
|
};
|
|
444
563
|
}
|
|
445
564
|
|
|
565
|
+
/**
|
|
566
|
+
* An open merge request's apply under the waves before merge (#4984): the
|
|
567
|
+
* decision records the head, and the run is a pipeline of the default branch
|
|
568
|
+
* started with the decision's three variables, which the wave jobs' guard
|
|
569
|
+
* checks against the record.
|
|
570
|
+
*/
|
|
571
|
+
async function wavesBeforeMergeRun(jobs: ChantNoteJobs, deps: NonNullable<ChantNoteRunsOptions["beforeMerge"]>, c: Omit<NoteCommand, "role">): Promise<NoteRun> {
|
|
572
|
+
const parsed = c.parsed as Extract<NoteCommand["parsed"], { kind: "apply" }>;
|
|
573
|
+
const { decideWavesBeforeMerge } = await import("./op/before-merge-decide");
|
|
574
|
+
const { BEFORE_MERGE_DIGEST_ENV, BEFORE_MERGE_HEAD_ENV, BEFORE_MERGE_PR_ENV } = await import("./op/before-merge");
|
|
575
|
+
let variables: Record<string, string> | undefined;
|
|
576
|
+
const done = await decideWavesBeforeMerge({
|
|
577
|
+
...deps,
|
|
578
|
+
forge: "gitlab",
|
|
579
|
+
pr: c.mr,
|
|
580
|
+
user: c.note.author ?? "",
|
|
581
|
+
base: c.base,
|
|
582
|
+
...(parsed.wave !== undefined ? { wave: parsed.wave } : {}),
|
|
583
|
+
op: jobs.waves!.op,
|
|
584
|
+
count: jobs.waves!.count,
|
|
585
|
+
jobs: jobs.wavesBeforeMerge!,
|
|
586
|
+
words: c.words,
|
|
587
|
+
// The poll starts the pipeline once the decision is recorded, and its reply links it.
|
|
588
|
+
start: async (r) => {
|
|
589
|
+
variables = { [BEFORE_MERGE_PR_ENV]: String(r.pr), [BEFORE_MERGE_HEAD_ENV]: r.head, [BEFORE_MERGE_DIGEST_ENV]: r.digest };
|
|
590
|
+
return {};
|
|
591
|
+
},
|
|
592
|
+
});
|
|
593
|
+
if (done.kind !== "ran") return done.kind === "fail" ? { kind: "fail", reason: done.reason } : { kind: "reply", text: done.text };
|
|
594
|
+
const through = parsed.wave !== undefined && parsed.wave < jobs.waves!.count ? ` through wave ${parsed.wave}` : "";
|
|
595
|
+
return { kind: "pipeline", ref: c.base, variables: variables!, doing: `${c.words.verbs.apply[0]} !${c.mr.number}'s head ${short(c.mr.headSha ?? "")}${through} before it merges` };
|
|
596
|
+
}
|
|
597
|
+
|
|
446
598
|
/** The directory on `chant/lifecycle` that keeps the notes the poll answered. */
|
|
447
599
|
export const NOTES_DIR = "_notes";
|
|
448
600
|
|
package/src/ci-product-words.ts
CHANGED
|
@@ -68,8 +68,48 @@ export interface CiProductAlias {
|
|
|
68
68
|
command: CiProductCommand;
|
|
69
69
|
/** The variable that turns the alias on in a job (terragucci's `TG_ATLANTIS_COMMENTS`). Absent: always on. */
|
|
70
70
|
when?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Flags of the other tool that the product has no counterpart for, each
|
|
73
|
+
* with the reply that refuses it (#4946), such as terragucci's `{ "-p":
|
|
74
|
+
* "a root goes by its path, not a project name: ..." }` on `atlantis
|
|
75
|
+
* plan`. A flag here is refused before the alias reads `-d`, so a product
|
|
76
|
+
* can refuse `atlantis apply -d` too. `--` refuses everything after it.
|
|
77
|
+
*/
|
|
78
|
+
refuse?: Record<string, string>;
|
|
71
79
|
}
|
|
72
80
|
|
|
81
|
+
/**
|
|
82
|
+
* What a comment job replies to a command the pipeline runs no job for
|
|
83
|
+
* (#4946), in the product's own sentences. Each slot left out takes
|
|
84
|
+
* chant's. The comment job on GitHub and Forgejo and the note poll on
|
|
85
|
+
* GitLab both read these.
|
|
86
|
+
*/
|
|
87
|
+
export interface CiProductCommentReplies {
|
|
88
|
+
/** A plan comment where no job plans on a comment (GitHub and Forgejo; GitLab starts a merge request pipeline). */
|
|
89
|
+
plan?: string;
|
|
90
|
+
/** An apply comment where no job applies on a comment: neither an apply before merge nor the re-run of a merged pull request's apply. */
|
|
91
|
+
apply?: string;
|
|
92
|
+
/** A lock comment where the pipeline takes no locks. */
|
|
93
|
+
lock?: string;
|
|
94
|
+
/** An unlock comment where the pipeline takes no locks. */
|
|
95
|
+
unlock?: string;
|
|
96
|
+
/** An action comment where no workflow runs actions (GitHub and Forgejo; GitLab names the checkout to run it from). */
|
|
97
|
+
action?: string;
|
|
98
|
+
/** An agent comment where the agent is off. */
|
|
99
|
+
agent?: string;
|
|
100
|
+
/** Any command on a pull request from a fork. */
|
|
101
|
+
fork?: string;
|
|
102
|
+
/**
|
|
103
|
+
* A comment that names a member the pipeline was not written with, over
|
|
104
|
+
* `{member}` (the one named) and `{members}` (the pipeline's, each in
|
|
105
|
+
* backticks, sorted, comma separated).
|
|
106
|
+
*/
|
|
107
|
+
member?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The reply slots, for checking a product's words. */
|
|
111
|
+
export const CI_PRODUCT_COMMENT_REPLIES: readonly (keyof CiProductCommentReplies)[] = ["plan", "apply", "lock", "unlock", "action", "agent", "fork", "member"];
|
|
112
|
+
|
|
73
113
|
/** The words a product passes. Every slot is optional; a missing one takes chant's. */
|
|
74
114
|
export interface CiProductWordsInput {
|
|
75
115
|
/** The status prefix, the note heading and the comment prefix: `chant`, `terragucci`, `plywood`. */
|
|
@@ -124,6 +164,8 @@ export interface CiProductWordsInput {
|
|
|
124
164
|
adoptMarkers?: string[];
|
|
125
165
|
/** What chant's notify sends under these words (#4610). */
|
|
126
166
|
notify?: CiProductNotifyWordsInput;
|
|
167
|
+
/** The replies to commands the pipeline runs no job for (#4946). Default: chant's. */
|
|
168
|
+
replies?: CiProductCommentReplies;
|
|
127
169
|
}
|
|
128
170
|
|
|
129
171
|
/** The notify slots a product passes (#4610). */
|
|
@@ -174,6 +216,8 @@ export interface CiProductWords {
|
|
|
174
216
|
bin?: string;
|
|
175
217
|
adoptMarkers: string[];
|
|
176
218
|
notify: CiProductNotifyWords;
|
|
219
|
+
/** The product's replies to commands no job runs (#4946), when it gives any. */
|
|
220
|
+
replies?: CiProductCommentReplies;
|
|
177
221
|
}
|
|
178
222
|
|
|
179
223
|
/** chant's own approve line. */
|
|
@@ -227,6 +271,7 @@ export function resolveProductWords(input: CiProductWordsInput | CiProductWords
|
|
|
227
271
|
headers: input.notify?.headers ?? `x-${product}`,
|
|
228
272
|
...(input.notify?.message ? { message: input.notify.message } : {}),
|
|
229
273
|
},
|
|
274
|
+
...(input.replies !== undefined ? { replies: input.replies } : {}),
|
|
230
275
|
};
|
|
231
276
|
}
|
|
232
277
|
|
|
@@ -278,6 +323,17 @@ export function productWordsProblems(words: CiProductWords, options: { jobs?: re
|
|
|
278
323
|
for (const a of words.aliases) {
|
|
279
324
|
if (!/^[a-z0-9][a-z0-9 -]*$/.test(a.from)) problems.push(`the alias ${JSON.stringify(a.from)} is lowercase words`);
|
|
280
325
|
if (!Object.values(words.commands).includes(a.command)) problems.push(`the alias ${JSON.stringify(a.from)} stands for ${a.command}, which no command names`);
|
|
326
|
+
// #4946: a refused flag is one word starting with -, and its reply one line.
|
|
327
|
+
for (const [flag, reason] of Object.entries(a.refuse ?? {})) {
|
|
328
|
+
if (!/^--?[A-Za-z0-9-]*$/.test(flag)) problems.push(`the alias ${JSON.stringify(a.from)} refuses ${JSON.stringify(flag)}, and a flag is - or -- then letters, digits and -`);
|
|
329
|
+
if (typeof reason !== "string" || reason.trim() === "" || /[\r\n]/.test(reason)) problems.push(`the alias ${JSON.stringify(a.from)} refuses ${flag} with no one-line reply`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// #4946: each reply is one line of text; the member reply's placeholders are {member} and {members}.
|
|
333
|
+
for (const [slot, text] of Object.entries(words.replies ?? {})) {
|
|
334
|
+
if (!CI_PRODUCT_COMMENT_REPLIES.includes(slot as keyof CiProductCommentReplies)) problems.push(`replies.${slot} is not one of ${CI_PRODUCT_COMMENT_REPLIES.join(", ")}`);
|
|
335
|
+
else if (typeof text !== "string" || text.trim() === "" || /[\r\n]/.test(text)) problems.push(`replies.${slot} is one line of text`);
|
|
336
|
+
else for (const m of text.matchAll(/\{([^}]*)\}/g)) if (slot !== "member" || (m[1] !== "member" && m[1] !== "members")) problems.push(`replies.${slot} names {${m[1]}}, which chant does not fill`);
|
|
281
337
|
}
|
|
282
338
|
for (const [where, template] of [["approve", words.approve], ["override", words.override]] as const) {
|
|
283
339
|
for (const m of template.matchAll(/\{([^}]*)\}/g)) if (!PLACEHOLDERS.has(m[1]!)) problems.push(`${where} names {${m[1]}}, which chant does not fill`);
|
|
@@ -560,6 +616,9 @@ export function parseProductComment(
|
|
|
560
616
|
const args: string[] = [];
|
|
561
617
|
for (let i = 0; i < rest.length; i++) {
|
|
562
618
|
const w = rest[i]!;
|
|
619
|
+
// #4946: a flag the product has no counterpart for gets the product's own reason.
|
|
620
|
+
const refused = a.refuse && Object.prototype.hasOwnProperty.call(a.refuse, w) ? a.refuse[w] : undefined;
|
|
621
|
+
if (refused !== undefined) return { kind: "refused", reason: refused };
|
|
563
622
|
if (w === "-d" || w === "--dir") {
|
|
564
623
|
const dir = rest[++i];
|
|
565
624
|
if (dir === undefined) return { kind: "refused", reason: `\`${w}\` names the ${words.noun[0]}'s directory` };
|
package/src/ci-product.ts
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { CiProductWords, CiProductWordsInput } from "./ci-product-words";
|
|
13
|
+
import { NEXT_RELEASE } from "./release-floors";
|
|
13
14
|
import type { ProductMcpHook } from "./cli/mcp/product-tools";
|
|
14
15
|
import type { ProductWaveHook } from "./op/op-waves-after-plan";
|
|
15
16
|
import { OTLP_EXPORTER_FLOOR } from "./otlp";
|
|
16
|
-
import { NEXT_RELEASE } from "./release-floors";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The first chant with the product pipeline (#4550): the words, the
|
|
@@ -140,26 +140,110 @@ export { planNoteHandoff, PR_PLAN_NOTE_FILE, type PrPlanNoteHandoff } from "./pr
|
|
|
140
140
|
/**
|
|
141
141
|
* The first chant whose product plan carries the plan-job steps beside the plan verb and the note job's own lines (#4899, #4931): `productPlan.login` and a target's `login` (ci-login) with the job's OIDC token, `idTokens`, `pending`, `controlRead`, `setup` steps, job-level `env`, `report`, `concurrency`, the comment re-plan `replan`, and `noteSteps`; a hand-off's `marker` kept under the note words' `productMarker`; and the note job's notices and overdue Ops under a hand-off's counts.
|
|
142
142
|
*/
|
|
143
|
-
export const PRODUCT_PLAN_STEPS_FLOOR =
|
|
143
|
+
export const PRODUCT_PLAN_STEPS_FLOOR = "0.124.88";
|
|
144
144
|
export { PLAN_ARGUMENT_ENV, PLAN_NOTE_NOTICES_ENV, type ProductPlanReplanJob, type ProductPlanSetupStep } from "./components/product-plan";
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* The first chant whose `parseProductComment` takes `leaveCommit` and that has `commitWordOf` (#4890): a comment job that is not the commit job leaves every comment for a commit word to it, a malformed one included, so the comment gets one reply.
|
|
148
148
|
*/
|
|
149
|
-
export const COMMENT_LEAVES_COMMIT_FLOOR =
|
|
149
|
+
export const COMMENT_LEAVES_COMMIT_FLOOR = "0.124.88";
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The first chant with the comment job on GitHub and Forgejo and the replies to commands no job runs (#4946): `commentJob` in the product pipeline (`chant components pr-comment`, `answerProductComment` in `@intentius/chant/ci-comment-commands`), which replies to a refusal and to a command the pipeline runs no job for, and with waves on merge starts a merged pull request's apply again; the words' `replies` and an alias's `refuse`, which the GitLab note poll reads too, as `chantNoteRuns`' `members`; `retryApply`; and `locks: "plan"` in GitHub's and Forgejo's product plan, with the lock, unlock and comment lock jobs.
|
|
153
|
+
*/
|
|
154
|
+
export const COMMENT_COMMANDS_FLOOR = "0.124.89";
|
|
155
|
+
export { answerProductComment, answeredElsewhere, COMMENT_JOBS_ENV, commentRuns, PR_COMMENT_JOB, RERUN_APPLY_JOBS, type CommentJobs, type CommentOutcome, type CommentRuns, type AnswerCommentOptions } from "./ci-comment-commands";
|
|
156
|
+
export { forkReply, memberReply, notRunReply } from "./ci-comment-replies";
|
|
157
|
+
export type { CiProductCommentReplies } from "./ci-product-words";
|
|
158
|
+
export { productCommentJob, type ProductCommentJob } from "./components/product-pipeline";
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The first chant whose product plan locks what a change reaches (#4979): `productPlan.reach`, a reach line the lock job runs at the target branch's commit with `chant lock --reach` (`@intentius/chant/lifecycle/reach-locks`), on GitHub, Forgejo and GitLab, where the lock job runs in the plan notes pipeline with `--open` beside the comment lock and unlock jobs; and whose comment job answers a re-plan comment with flags the product plan's re-plan cannot take (`noPlanFlags`).
|
|
162
|
+
*/
|
|
163
|
+
export const PRODUCT_PLAN_REACH_LOCKS_FLOOR = "0.124.89";
|
|
164
|
+
export { LOCK_REACH_ENV, reachedTargets, reachOpen, type Reached, type ReachInput } from "./lifecycle/reach-locks";
|
|
165
|
+
export { productPlanReachLock, type ProductPlanReachLock } from "./components/product-plan";
|
|
166
|
+
export { planFlagsReply } from "./ci-comment-commands";
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The first chant whose comment job stops a merged pull request's re-run at a wave (#4979): `/<product> apply wave-<n>` writes a stop for the merge commit on `chant/lifecycle` (`_waves/<op>.stops.json`, `@intentius/chant/op/wave-stop`) before GitHub's re-run or Forgejo's dispatch, and `chant run wave` leaves each wave after n waiting (exit 3).
|
|
170
|
+
*/
|
|
171
|
+
export const WAVE_STOP_FLOOR = "0.124.89";
|
|
172
|
+
export { setWaveStop, waveStopAt, waveStopLine, type WaveStop } from "./op/wave-stop";
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The first chant whose Op waves run before merge (#4984): `wavesBeforeMerge` in the product pipeline, where the comment job (GitHub, Forgejo) or the note poll (GitLab) decides `/<product> apply [wave-<n>]` on an open pull request (`decideWavesBeforeMerge`, `@intentius/chant/op/before-merge-decide`), records the head and its digest on `chant/lifecycle` (`_waves/<op>.before-merge.json`) and starts the waves for it; the generators' `beforeMerge`, whose guard admits that head alone, whose jobs check it out and read the base from the default branch, and whose `before-merge-done` job merges and releases the locks (`chant run wave --merge`); `waveJobs.<wave>.prelude`; the GitLab note poll's wave stop (`chantNoteRuns`' `waves`); a re-plan word that never starts with `-`; and the terraform lexicon's reach helpers (`@intentius/chant-lexicon-terraform/reach`).
|
|
176
|
+
*/
|
|
177
|
+
export const WAVES_BEFORE_MERGE_FLOOR = NEXT_RELEASE;
|
|
178
|
+
export { BEFORE_MERGE_DIGEST_ENV, BEFORE_MERGE_DONE_JOB, BEFORE_MERGE_HEAD_ENV, BEFORE_MERGE_PR_ENV, beforeMergeDigest, beforeMergePath, beforeMergeProblems, WAVES_BASE_ENV, type BeforeMergeDecision, type BeforeMergeRecord, type OpWavesBeforeMerge } from "./op/before-merge";
|
|
179
|
+
export { decideWavesBeforeMerge, defaultPipelineFiles, type WavesBeforeMergeJobs } from "./op/before-merge-decide";
|
|
180
|
+
export type { ProductWavesBeforeMerge } from "./components/product-pipeline";
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The first chant whose Op waves post the apply statuses (#4987): the generators' `applyStatus`, a job `apply-status-<n>` after each wave at the default branch's commit that posts `<product>/apply` on the commit the waves applied (a before-merge run's decided head) with `chant run wave --apply-status` (`@intentius/chant/op/apply-status`), and the product pipeline's `applyStatus`; whose product plan takes `staleNotes`, each target's note carrying the target branch's commit and a `stale-notes` job beside wave 1 on a push marking each target's note (`pr-post --stale` with one `--member` per target); whose `productPipelineJobs` returns `waves.pipeline` for the generators; and whose GitLab reach line reaches the lock and note-commands jobs unexpanded (`expand: false`).
|
|
184
|
+
*/
|
|
185
|
+
export const WAVES_APPLY_STATUS_FLOOR = NEXT_RELEASE;
|
|
186
|
+
export { applyStatusJobName, opWaveApplyStatus, postOpWaveApplyStatus, type OpWaveApplyStatus, type OpWavesApplyStatus } from "./op/apply-status";
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The first chant whose before-merge waves never run the change's code beside a write token (#4987): with `beforeMerge` each wave is a plan job (the change's code, a checkout with no credentials kept, a read-only token; GitLab drops `CHANT_FORGE_TOKEN` and the job token), a gate job at the default branch with the token, an applying job on the saved plan with no write token, and a record job at the default branch that writes the run records (`chant run wave --phase plan|gate|apply|record`, `@intentius/chant/op/op-waves-split`). A `rest` wave is refused with `beforeMerge`.
|
|
190
|
+
*/
|
|
191
|
+
export const WAVES_BEFORE_MERGE_SPLIT_FLOOR = NEXT_RELEASE;
|
|
192
|
+
export { opWaveSplitJobs, type OpWavePhase, type OpWaveSplitJob } from "./op/op-waves-split";
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The first chant whose split before-merge waves take a `step` spec, Forgejo's hand-off, holds on other gates and one approval per wave (#4992): the plan job saves each run's step plan, the gate job leases the rows they change (no heartbeat; the decision names the lease) before it spends the approval, the applying job plans its runs again through the step and applies each whose digest the decision holds, and the record job writes the release records and lets go of the rows; a hook in the plan or apply job that holds the wave on another gate reads it with no write token and leaves its pending fact to the gate or record job; on Forgejo the plan and applying jobs hand their files on as job outputs (`packJs`), never through the artifact upload, and the gate and record jobs keep them as the artifacts; the plan job names no environment on GitHub (a wave's `planEnvironment` when set; on GitLab it prepares it), so the environment's reviewers are asked once. A `rest` wave splits from {@link WAVES_BEFORE_MERGE_REST_FLOOR} on.
|
|
196
|
+
*/
|
|
197
|
+
export const WAVES_BEFORE_MERGE_STEP_FLOOR = NEXT_RELEASE;
|
|
198
|
+
export type { OpWaveSavedStep, OpWaveSplitHandoff, OpWaveSplitLease } from "./op/op-waves-run";
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The first chant whose split waves run a product's own process in every job (#4994): the product wave hook's `hooks` (`runChantInProcess(["run", "wave", ..., "--phase", <phase>], words, { wave: { afterPlan, capabilities, hookExec, runHooks, hooks } })`, `RunOpWaveOptions.inProcessHooks`) serves a spec hook by its name in the process of whichever job runs it, plan, gate or applying job or the one-job shape, in place of a command that called back over a socket; `opWaveProductStateDir` is where the plan job's code keeps what the later jobs read; a `record: true` hold in the plan job is spent by the gate job for a re-run of the hook at the wave's commit (an applied line with `rerun.head`), which the next run's plan job runs and its gate job finishes (`holdsFinished`); and `waveJobs.<wave>.artifact.path` takes a list and `waveJobs.<wave>.gate` gives the gate job a report and an artifact, so a product's own upload steps go through chant's Forgejo hand-off.
|
|
202
|
+
*/
|
|
203
|
+
export const WAVES_PRODUCT_HOOKS_FLOOR = NEXT_RELEASE;
|
|
204
|
+
export type { OpWaveHandedFinished, OpWaveInProcessHook, OpWaveInProcessHookCall } from "./op/op-waves-run";
|
|
205
|
+
export { opWaveProductStateDir } from "./op/op-waves-split";
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The first chant whose split before-merge waves take a `rest` wave (#4992): its four jobs run one wave per run, the wave `CHANT_WAVES_WAVE` names (their own by default), and its record job, once the run applied and the plan found another wave, starts the waves workflow again for it (GitHub and Forgejo: a dispatch with the inputs `wave` and the decision's `pr`, `head` and `digest`, or a push's `commit`; GitLab: a pipeline with the same variables, with `CHANT_FORGE_TOKEN`), whose guard admits it as the same decided head; the jobs of the waves before it do not run in that follow-on; the record job's note (`rest-wave.json` beside the outcomes, `@intentius/chant/op/op-waves-follow-on`) tells `before-merge-done`, the control dispatch and the apply status that a run which started a follow-on is not the last.
|
|
209
|
+
*/
|
|
210
|
+
export const WAVES_BEFORE_MERGE_REST_FLOOR = NEXT_RELEASE;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The first chant whose rest wave's record job records each follow-on it starts on `chant/lifecycle` before it starts it (#4998): `_waves/<op>.follow-on.json` keeps, per decided head or pushed commit, the wave started, the run that started it, the decision (`pr`, `digest`) or the `commit`, and the outcomes of every run of the chain so far; the guard admits a follow-on only for the wave that record names, so a wave started by hand past it is refused; and the last run's control dispatch, apply status and `before-merge-done` add up the outcomes of every run of the chain (the note's `chain`), so a chain whose last wave changed nothing reports `applied`.
|
|
214
|
+
*/
|
|
215
|
+
export const WAVES_FOLLOW_ON_RECORD_FLOOR = NEXT_RELEASE;
|
|
150
216
|
|
|
151
217
|
/**
|
|
152
218
|
* The first chant whose product plan takes `watches`, the product's own scheduled jobs the note job's `pr-post` checks for having stopped with the job's token (#4888), and whose `checkOverdueOps` and `overdueOpsAt` take a product's `logPrefix` and `label`.
|
|
153
219
|
*/
|
|
154
|
-
export const PRODUCT_PLAN_WATCHES_FLOOR =
|
|
155
|
-
export { PLAN_WATCHES_ENV } from "./op/schedule-overdue";
|
|
220
|
+
export const PRODUCT_PLAN_WATCHES_FLOOR = "0.124.88";
|
|
221
|
+
export { PLAN_WATCHES_ENV, watchesForTarget } from "./op/schedule-overdue";
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The first chant whose product plan's `watches` take `targets` (#4988): a watch scoped to those targets is checked by their notes alone, and the note of another target checks neither it nor the discovered Op of its name (`watchesForTarget`).
|
|
225
|
+
*/
|
|
226
|
+
export const PRODUCT_PLAN_WATCH_TARGETS_FLOOR = NEXT_RELEASE;
|
|
156
227
|
|
|
157
228
|
/**
|
|
158
229
|
* The first chant whose product plan takes `record` (#4899): the plan step writes the plan job's run record into the hand-off, and the note job keeps it as Op `pr-plan` on `chant/lifecycle` with `pr-post --record-run <plan job>` (`--open` on GitLab), as `chant ci run plan --in-place` records `pr-plan`'s.
|
|
159
230
|
*/
|
|
160
|
-
export const PRODUCT_PLAN_RECORD_FLOOR =
|
|
231
|
+
export const PRODUCT_PLAN_RECORD_FLOOR = "0.124.88";
|
|
161
232
|
export { PLAN_RUN_OP, PLAN_RUN_RECORD_FILE, readPlanRunRecord } from "./pr-plan-record";
|
|
162
233
|
|
|
234
|
+
/**
|
|
235
|
+
* The first chant whose product plan carries what terragucci's and sql-yodeler's plan jobs did themselves (#4963, #4951): `trade` (a plan's or a target's) before the checkout, `replan: { dispatch, reply, notAffected }` (a re-plan from `workflow_dispatch`, a reply to a comment no other job takes, `pr-post --not-affected`), `previousMarker` (`CHANT_PLAN_PREVIOUS_MARKER`), `noteSteps.pullRequest`, a `PrReport`'s `marker`, and a hand-off of the product's own note text (`planBodyHandoff`).
|
|
236
|
+
*/
|
|
237
|
+
export const PRODUCT_PLAN_REPLAN_FLOOR = "0.124.89";
|
|
238
|
+
export { gitlabReplanArgumentLines, PREVIOUS_MARKER_JS, replanDecideJs, type ProductPlanReplanOptions } from "./components/product-plan";
|
|
239
|
+
export { planBodyHandoff, PLAN_BODY_LIMIT, type PrPlanBodyHandoff } from "./pr-plan-note";
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The first chant whose note job compares the plan's subject with the previous note's (#4972), on GitHub, Forgejo and GitLab: a plan note hand-off's `subject` (`PrPlanSubject`, an id and named parts) is kept in the note, and `pr-post` adds the note words' `sinceLast` line, naming the parts added, gone and changed (`subjectParts`), when the previous note kept another id. The plan job reads no note, and `previousMarker` is deprecated.
|
|
243
|
+
*/
|
|
244
|
+
export const PRODUCT_PLAN_SUBJECT_FLOOR = "0.124.89";
|
|
245
|
+
export { PLAN_SUBJECT_LIMIT, planSubjectProblem, sinceLastLine, subjectChanges, type PrPlanSubject, type PrPlanSubjectPartWords } from "./pr-plan-note";
|
|
246
|
+
|
|
163
247
|
/**
|
|
164
248
|
* Day-2 actions in the product pipeline (#4654): the `action` comment
|
|
165
249
|
* command counted as answered by the product's own workflow
|
|
@@ -770,6 +770,47 @@ export const testEntity = {
|
|
|
770
770
|
expect(existsSync(join(testDir, "dist", "ops", "alb-deploy", "worker.ts"))).toBe(true);
|
|
771
771
|
});
|
|
772
772
|
|
|
773
|
+
describe("--output naming a directory (#4950)", () => {
|
|
774
|
+
/** Stands in for the docker lexicon on a project of Dockerfiles alone: a blank compose file and one file per Dockerfile. */
|
|
775
|
+
const dockerfilesOnly = (primary = "\n"): Serializer => ({
|
|
776
|
+
name: "dock",
|
|
777
|
+
rulePrefix: "DOCK",
|
|
778
|
+
serialize: () => ({ primary, files: { "Dockerfile.tofu": "FROM tofu\n", "Dockerfile.node": "FROM node\n" } }),
|
|
779
|
+
});
|
|
780
|
+
const declare = () =>
|
|
781
|
+
writeFile(
|
|
782
|
+
join(testDir, "images.ts"),
|
|
783
|
+
`export const tofu = { [Symbol.for("chant.declarable")]: true, entityType: "Docker::Dockerfile", lexicon: "dock", kind: "resource", props: {}, attributes: {} };\n`,
|
|
784
|
+
);
|
|
785
|
+
|
|
786
|
+
test("writes the additional files into it and no primary file, when the primary output is blank", async () => {
|
|
787
|
+
await declare();
|
|
788
|
+
const dir = join(testDir, "out", "images");
|
|
789
|
+
const result = await buildCommand({ path: testDir, output: `${dir}/`, format: "yaml", serializers: [dockerfilesOnly()] });
|
|
790
|
+
expect(result.errors).toEqual([]);
|
|
791
|
+
expect(readFileSync(join(dir, "Dockerfile.tofu"), "utf8")).toBe("FROM tofu\n");
|
|
792
|
+
expect(readFileSync(join(dir, "Dockerfile.node"), "utf8")).toBe("FROM node\n");
|
|
793
|
+
expect(existsSync(join(testDir, "out", "images.yaml"))).toBe(false);
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
test("takes an existing directory without the trailing slash", async () => {
|
|
797
|
+
await declare();
|
|
798
|
+
const dir = join(testDir, "existing");
|
|
799
|
+
await mkdir(dir, { recursive: true });
|
|
800
|
+
const result = await buildCommand({ path: testDir, output: dir, format: "yaml", serializers: [dockerfilesOnly()] });
|
|
801
|
+
expect(result.errors).toEqual([]);
|
|
802
|
+
expect(readFileSync(join(dir, "Dockerfile.tofu"), "utf8")).toBe("FROM tofu\n");
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
test("refuses a build with a primary output, which needs a file", async () => {
|
|
806
|
+
await declare();
|
|
807
|
+
const result = await buildCommand({ path: testDir, output: `${join(testDir, "d")}/`, format: "yaml", serializers: [dockerfilesOnly("services:\n a: {}\n")] });
|
|
808
|
+
expect(result.success).toBe(false);
|
|
809
|
+
expect(result.errors.join("\n")).toContain("names a directory");
|
|
810
|
+
expect(existsSync(join(testDir, "d", "Dockerfile.tofu"))).toBe(false);
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
|
|
773
814
|
describe("committed-encrypted secret sidecars", () => {
|
|
774
815
|
const CIPHERTEXT = 'apiVersion: v1\nkind: Secret\nstringData:\n T: ENC[AES256_GCM,data:xx]\nsops:\n version: 3.9.4\n';
|
|
775
816
|
|