@intentius/chant 0.124.90 → 0.124.92
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 +5 -3
- package/dist/actor.d.ts.map +1 -1
- package/dist/actor.js +7 -5
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/core.js +11 -1
- package/dist/ci-comment-commands.d.ts +11 -1
- package/dist/ci-comment-commands.d.ts.map +1 -1
- package/dist/ci-comment-commands.js +10 -3
- package/dist/ci-product.d.ts +27 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +36 -10
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -1
- package/dist/cli/handlers/pr-comment.js +17 -4
- package/dist/cli/handlers/pr.d.ts +2 -2
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +32 -10
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +13 -0
- package/dist/cli/registry.d.ts +4 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-checks.d.ts +11 -0
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +15 -5
- package/dist/components/pr-pipeline.d.ts +13 -4
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +23 -9
- package/dist/components/product-pipeline.d.ts +41 -7
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +63 -23
- package/dist/components/product-plan.d.ts +86 -1
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +141 -16
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +18 -9
- package/dist/lexicon-module.d.ts +2 -0
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +6 -2
- package/dist/lexicon.d.ts +42 -1
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/op/before-merge-decide.d.ts +2 -0
- package/dist/op/before-merge-decide.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.d.ts +3 -2
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +4 -3
- package/dist/op/op-waves-follow-on.d.ts +2 -0
- package/dist/op/op-waves-follow-on.d.ts.map +1 -1
- package/dist/op/op-waves-follow-on.js +8 -2
- package/dist/op/op-waves-names.d.ts +122 -0
- package/dist/op/op-waves-names.d.ts.map +1 -0
- package/dist/op/op-waves-names.js +151 -0
- package/dist/planned-files.d.ts +16 -8
- package/dist/planned-files.d.ts.map +1 -1
- package/dist/planned-files.js +12 -8
- package/dist/pr-forge-job.d.ts +8 -0
- package/dist/pr-forge-job.d.ts.map +1 -1
- package/dist/pr-forge-job.js +13 -0
- package/dist/pr-plan-record.d.ts +3 -1
- package/dist/pr-plan-record.d.ts.map +1 -1
- package/dist/pr-plan-record.js +1 -1
- package/dist/pr-post.d.ts +15 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +10 -6
- package/dist/release-floors.d.ts +7 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +8 -2
- package/dist/wave-runtime.mjs +276 -276
- package/package.json +1 -1
- package/src/actor.test.ts +14 -1
- package/src/actor.ts +8 -6
- package/src/audit/core.ts +13 -1
- package/src/audit/first-load.test.ts +101 -0
- package/src/ci-comment-commands.test.ts +19 -5
- package/src/ci-comment-commands.ts +18 -3
- package/src/ci-product.ts +42 -10
- package/src/cli/handlers/pr-comment.ts +14 -4
- package/src/cli/handlers/pr.ts +27 -10
- package/src/cli/parse-args.ts +9 -0
- package/src/cli/registry.ts +4 -0
- package/src/components/pr-checks.ts +16 -5
- package/src/components/pr-pipeline.ts +24 -11
- package/src/components/product-job-names.test.ts +176 -0
- package/src/components/product-pipeline.ts +101 -31
- package/src/components/product-plan-names.test.ts +135 -0
- package/src/components/product-plan.ts +218 -18
- package/src/floor-table.data.ts +18 -9
- package/src/lexicon-module.ts +6 -2
- package/src/lexicon.ts +42 -1
- package/src/op/before-merge-decide.ts +2 -0
- package/src/op/op-waves-evidence-jobs.ts +4 -3
- package/src/op/op-waves-follow-on.ts +10 -2
- package/src/op/op-waves-names.test.ts +131 -0
- package/src/op/op-waves-names.ts +241 -0
- package/src/planned-files.test.ts +33 -0
- package/src/planned-files.ts +26 -10
- package/src/pr-forge-job.ts +13 -0
- package/src/pr-plan-record.ts +4 -2
- package/src/pr-post-head.test.ts +116 -0
- package/src/pr-post.ts +26 -9
- package/src/release-floors.ts +11 -2
package/src/floor-table.data.ts
CHANGED
|
@@ -38,18 +38,24 @@ export const FLOOR_ROWS: readonly FloorRow[] = [
|
|
|
38
38
|
{ name: "COMMENT_COMMANDS_FLOOR", version: "0.124.89", gates: "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.", issue: "#4946", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
39
39
|
{ name: "PRODUCT_PLAN_REACH_LOCKS_FLOOR", version: "0.124.89", gates: "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`).", issue: "#4979", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
40
40
|
{ name: "WAVE_STOP_FLOOR", version: "0.124.89", gates: "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).", issue: "#4979", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
41
|
-
{ name: "WAVES_BEFORE_MERGE_FLOOR", version:
|
|
42
|
-
{ name: "WAVES_APPLY_STATUS_FLOOR", version:
|
|
43
|
-
{ name: "WAVES_BEFORE_MERGE_SPLIT_FLOOR", version:
|
|
44
|
-
{ name: "WAVES_BEFORE_MERGE_STEP_FLOOR", version:
|
|
45
|
-
{ name: "WAVES_PRODUCT_HOOKS_FLOOR", version:
|
|
46
|
-
{ name: "WAVES_BEFORE_MERGE_REST_FLOOR", version:
|
|
47
|
-
{ name: "WAVES_FOLLOW_ON_RECORD_FLOOR", version:
|
|
41
|
+
{ name: "WAVES_BEFORE_MERGE_FLOOR", version: "0.124.90", gates: "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`).", issue: "#4984", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
42
|
+
{ name: "WAVES_APPLY_STATUS_FLOOR", version: "0.124.90", gates: "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`).", issue: "#4987", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
43
|
+
{ name: "WAVES_BEFORE_MERGE_SPLIT_FLOOR", version: "0.124.90", gates: "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`).", issue: "#4987", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
44
|
+
{ name: "WAVES_BEFORE_MERGE_STEP_FLOOR", version: "0.124.90", gates: "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.", issue: "#4992", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
45
|
+
{ name: "WAVES_PRODUCT_HOOKS_FLOOR", version: "0.124.90", gates: "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.", issue: "#4994", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
46
|
+
{ name: "WAVES_BEFORE_MERGE_REST_FLOOR", version: "0.124.90", gates: "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.", issue: "#4992", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
47
|
+
{ name: "WAVES_FOLLOW_ON_RECORD_FLOOR", version: "0.124.90", gates: "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`.", issue: "#4998", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
48
48
|
{ name: "PRODUCT_PLAN_WATCHES_FLOOR", version: "0.124.88", gates: "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`.", issue: "#4888", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
49
|
-
{ name: "PRODUCT_PLAN_WATCH_TARGETS_FLOOR", version:
|
|
49
|
+
{ name: "PRODUCT_PLAN_WATCH_TARGETS_FLOOR", version: "0.124.90", gates: "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`).", issue: "#4988", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
50
50
|
{ name: "PRODUCT_PLAN_RECORD_FLOOR", version: "0.124.88", gates: "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.", issue: "#4899", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
51
51
|
{ name: "PRODUCT_PLAN_REPLAN_FLOOR", version: "0.124.89", gates: "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`).", issue: "#4963", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
52
52
|
{ name: "PRODUCT_PLAN_SUBJECT_FLOOR", version: "0.124.89", gates: "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.", issue: "#4972", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
53
|
+
{ name: "PRODUCT_PLAN_NAMES_FLOOR", version: "0.124.91", gates: "The first chant whose product plan keeps a product's own names (#5003): `workflowFile` (the generators' `path`), `jobNames` (the plan, note, re-plan and re-plan note jobs, with `{target}`), `statusContext` (which `pr-post --context`, the pending step, the stale job and the apply before merge use) and `reportDir` (`{output}`, the hand-off, the artifact's path and `pr-post --output`), and whose `pr-post --open` finds a plan job of the product's name (`--plan-job`).", issue: "#5003", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
54
|
+
{ name: "PRODUCT_PLAN_ARTIFACTS_FLOOR", version: "0.124.91", gates: "The first chant whose GitLab product plan job keeps a product's own artifacts beside the report directory (#5004): `productPlan.artifacts: { paths, reports }`, as `artifacts:paths` and `artifacts:reports`, such as terragucci's `terraform` report for the merge request's widget, with `{target}` and `{output}` filled.", issue: "#5004", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
55
|
+
{ name: "PRODUCT_PLAN_LOGIN_TOKENS_FLOOR", version: NEXT_RELEASE, gates: "The first chant whose GitHub and Forgejo product plan, after a `login` or with `idTokens`, starts every step after the checkout but the login's without `ACTIONS_ID_TOKEN_REQUEST_URL` and `ACTIONS_ID_TOKEN_REQUEST_TOKEN` (#5021), as after a `trade`: the setup, the probe and the plan step, in the plan and the re-plan job, so the change's code can request no token.", issue: "#5021", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
56
|
+
{ name: "PR_HEAD_SHA_FLOOR", version: NEXT_RELEASE, gates: "The first chant whose pull request jobs on GitHub and Forgejo name the pull request's head, `github.event.pull_request.head.sha`, where `github.sha` named the merge preview (#5020): the product plan's pending step (`CHANT_PENDING_SHA`), the note job's `HEAD_SHA` (the product plan's, the pull request loop's and the product pipeline's) and the `env-post` job's.", issue: "#5020", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
57
|
+
{ name: "OP_WAVES_NAMES_FLOOR", version: NEXT_RELEASE, gates: "The first chant whose Op waves generators keep a product's own names (#5022): `jobNames` (every job they write: a wave's, deciding, share and job group jobs, a split wave's plan, gate, apply and record jobs, the policy and evidence jobs, the apply status, stale, before-merge done and control jobs; `needs:`, `if:`, `{job}` and `--from-job` follow it), `stageNames` (GitLab), `artifactNames` (the outcome, decision, saved plan and check claims artifacts, and the pattern a wave job downloads the earlier outcomes with), `workflowFile` (the generators' file and the follow-on's dispatch), `runIf` (the jobs go in the product's own workflow, each running on a push it admits or a before-merge or follow-on dispatch, with its own permissions; on GitLab joined to every rule) and `dispatchInputs` (the dispatch inputs' names, which the comment job's dispatch and the follow-on use), with `buildForgejoOpWavesDoc` for the Forgejo jobs, and whose product pipeline's `wavesBeforeMerge` takes `workflowFile` and `dispatchInputs`.", issue: "#5022", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
58
|
+
{ name: "PRODUCT_JOB_NAMES_FLOOR", version: NEXT_RELEASE, gates: "The first chant whose product pipeline names its comment job and its waves' jobs as the product does (#5027): `commentJob: { jobName }` (default `comment`, such as terragucci's `apply-comment`), refused when another job of the workflow has the name, and `wavesJobNames`, the Op waves generators' `jobNames`, which `waves.pipeline` carries to the generator and `waves.jobs` takes, and under which the comment job's re-run of a merged pull request's apply looks for the waves' jobs (`CHANT_COMMENT_JOBS` `applyJobs`, `rerunApplyJobs`), so terragucci's `apply-wave-<k>`, `-share-<n>`, group jobs and `apply-rest` run again.", issue: "#5027", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
53
59
|
{ name: "PRODUCT_ACTIONS_FLOOR", version: "0.124.58", gates: "Day-2 actions in the product pipeline (#4654): the `action` comment command counted as answered by the product's own workflow (`productPipelineJobs(forge, env, { words, actions: true })`), or the pipeline's own action job (`actionJob`, `build --pr-loop --action-job`), which answers the comment and a dispatch with a member and an action input, and runs the product's action verb with `--from-event`.", issue: "#4654", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
54
60
|
{ name: "APPROVAL_STATUS_FLOOR", version: "0.124.56", gates: "The approval status before merge (#4630): under a `pr-review` wave, the op waves generators add a job that posts `<product>/approval` on each open pull request's head.", issue: "#4630", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
55
61
|
{ name: "APPROVAL_STATUS_PULL_REQUEST_FLOOR", version: "0.124.56", gates: "The approval status for `pull-request` waves too (#4630, 2026-10-28 ruling): the generators add the record-plans and approval-status jobs for a spec whose waves take the pull request's own approval, and the status reads that approval's coverage of each wave's change set.", issue: "#4630", file: "ci-product.ts", modules: ["@intentius/chant/ci-product"] },
|
|
@@ -211,16 +217,19 @@ export const FLOOR_ROWS: readonly FloorRow[] = [
|
|
|
211
217
|
{ name: "DRIFT_NOTIFY_STACKS_FLOOR", version: "0.124.89", gates: "The first chant whose `driftNotifyFields` takes `stacks`, each member's drift records, and from them names the drifted members and computes the run's fingerprint (#4944).", issue: "#4944", file: "release-floors.ts", modules: ["@intentius/chant/release-floors"] },
|
|
212
218
|
{ name: "MEMBER_SIGNED_CHECKS_FLOOR", version: "0.124.89", gates: "The first chant whose workspace member's pull request pipeline takes `evidence`, `checkJob` and `refGateStatus` (`chant build --pr-loop` in a member), signing the member's plan job as `plan:<member>` and `policy:<member>` (`ci evidence sign --member`, `memberEvidenceCheck`) and running the check job in the member's directory (#4964).", issue: "#4964", file: "release-floors.ts", modules: ["@intentius/chant/ci-evidence-jobs","@intentius/chant/components/pr-checks","@intentius/chant/release-floors"] },
|
|
213
219
|
{ name: "PRODUCT_CHECK_JOBS_FLOOR", version: "0.124.89", gates: "The first chant whose `checkJob` takes `{ services, env, before, dir, args }` (`PrCheckJobOptions`: service containers, the check step's variables and lines, the report directory, the arguments after `--base`) and whose github, forgejo and gitlab lexicons render the check, check evidence and ref gate jobs for a product's own workflow (`productCheckJobs`, `forgejoProductCheckJobs`, `gitlabProductCheckJobs`) (#4964).", issue: "#4964", file: "release-floors.ts", modules: ["@intentius/chant/components/pr-checks","@intentius/chant/release-floors"] },
|
|
214
|
-
{ name: "CHECK_JOB_ARTIFACTS_FLOOR", version:
|
|
220
|
+
{ name: "CHECK_JOB_ARTIFACTS_FLOOR", version: "0.124.90", gates: "The first chant whose `checkJob` takes `artifacts: { paths, reports }` (`PrCheckArtifacts`), which GitLab's check job keeps beside its report as `artifacts:paths` and `artifacts:reports`, such as a lint hook's `codequality` report (#4988).", issue: "#4988", file: "release-floors.ts", modules: ["@intentius/chant/components/pr-checks","@intentius/chant/release-floors"] },
|
|
215
221
|
{ name: "GITLAB_WAVE_KEY_SCOPE_FLOOR", version: "0.124.89", gates: "The first chant whose GitLab Op waves pipeline with a runner key hands it to no wave job: each deciding wave's `<wave job>-evidence` job names the `chant-evidence` environment and signs `plan:<wave>` from the wave job (#4964).", issue: "#4964", file: "release-floors.ts", modules: ["@intentius/chant/ci-evidence-jobs","@intentius/chant/release-floors"] },
|
|
216
222
|
{ name: "ACTOR_ORDER_FLOOR", version: "0.124.89", gates: "The first chant with `actorOf` and `actorOrder` in `@intentius/chant/actor`: the actor fallback with `GITHUB_TRIGGERING_ACTOR` ahead of the forge's actor and git's `user.name` before the login, each place switched on or off by the caller (#4966).", issue: "#4966", file: "release-floors.ts", modules: ["@intentius/chant/actor","@intentius/chant/release-floors"] },
|
|
223
|
+
{ name: "ACTOR_GIT_ENV_FLOOR", version: "0.124.91", gates: "The first chant whose `actorOf({ env, repo })` runs `git config` in `repo` with the `env` it is given rather than the process's, so a job's `GIT_CONFIG_GLOBAL` or `HOME` picks the `user.name` it reads (#5005).", issue: "#5005", file: "release-floors.ts", modules: ["@intentius/chant/actor","@intentius/chant/release-floors"] },
|
|
217
224
|
{ name: "CI_BASE_REF_FLOOR", version: "0.124.89", gates: "The first chant with `@intentius/chant/ci-base` (`ciBaseRef`), the base a CI job measures a change from (the pull request's target branch, else the default branch for a push to another branch), and whose `chant ci check` defaults `--base` to it (#4966).", issue: "#4966", file: "release-floors.ts", modules: ["@intentius/chant/ci-base","@intentius/chant/release-floors"] },
|
|
218
225
|
{ name: "PLANNED_FILES_FLOOR", version: "0.124.89", gates: "The first chant with `@intentius/chant/planned-files` (`planFile`, `planRemoval`, `writePlannedFiles`, `staleGeneratedFiles`): an init's planned files with their modes, written or removed in one call, and the generated files a product no longer renders, found by their header (#4966).", issue: "#4966", file: "release-floors.ts", modules: ["@intentius/chant/planned-files","@intentius/chant/release-floors"] },
|
|
226
|
+
{ name: "PLANNED_BYTES_FLOOR", version: "0.124.91", gates: "The first chant whose `planFile` in `@intentius/chant/planned-files` takes bytes (`Uint8Array` or `Buffer`) as well as text: `writePlannedFiles` writes them unchanged and the plan compares them with the file byte for byte (#5006).", issue: "#5006", file: "release-floors.ts", modules: ["@intentius/chant/planned-files","@intentius/chant/release-floors"] },
|
|
219
227
|
{ name: "FORGE_CHECK_OWN_JOBS_FLOOR", version: "0.124.89", gates: "The first chant whose `pipelineContract` takes `jobs`, the jobs a product builds from its own config, beside or in place of `pipelines`, so a product's forge check gets the required statuses and `refGateStatus` from chant (#4966).", issue: "#4966", file: "release-floors.ts", modules: ["@intentius/chant/forge-check","@intentius/chant/forge-check/index","@intentius/chant/release-floors"] },
|
|
220
228
|
{ name: "BEFORE_MERGE_REF_GATE_FLOOR", version: "0.124.89", gates: "The first chant whose `chant components pr-apply --before-merge` waits for the ref gate's status: the status the policy at base sets for the target branch is passed as `require` to the `checks` require (#4966).", issue: "#4966", file: "release-floors.ts", modules: ["@intentius/chant/release-floors"] },
|
|
221
229
|
{ name: "TARGET_SIGNED_CHECKS_FLOOR", version: "0.124.89", gates: "The first chant whose product plan with `targets` and `evidence` signs each target's plan job as `plan:<target>` and `policy:<target>` (`ci evidence sign --member <target>`, `targetEvidenceCheck`, `productPlanEvidenceChecks`), and whose `refGateInitPlan` takes `targets` and names those checks in the `refs` rule (#4978).", issue: "#4978", file: "release-floors.ts", modules: ["@intentius/chant/ci-evidence-jobs","@intentius/chant/ref-gate-init","@intentius/chant/release-floors"] },
|
|
222
230
|
{ name: "RUNTIME_WAVES_SPEC_FLOOR", version: "0.124.89", gates: "The first chant whose Op waves generators take `renderSpec` (the wave jobs run `chant run wave --render-spec`, and `CHANT_WAVES_SPEC_COMMAND` names the product command that prints the spec at the commit in `CHANT_WAVES_SPEC_AT`), so a product whose spec is built from its config at base renders its wave jobs, policy step, evidence job and cloud trade through chant (#4982).", issue: "#4982", file: "release-floors.ts", modules: ["@intentius/chant/op","@intentius/chant/op/index","@intentius/chant/op/op-waves-render-spec","@intentius/chant/release-floors"] },
|
|
223
231
|
{ name: "GITLAB_WAVE_EVIDENCE_RETRY_FLOOR", version: "0.124.89", gates: "The first chant whose `chant run resume` (`resumeGateRun`) on GitLab retries a wave job's `<wave job>-evidence` with the wave job when the evidence job already ran, and whose `ci evidence sign --from-job` waits for a job it reads to finish, so a resumed wave's evidence job signs from the new try (#4978).", issue: "#4978", file: "release-floors.ts", modules: ["@intentius/chant/ci-evidence-jobs","@intentius/chant/release-floors"] },
|
|
232
|
+
{ name: "TERRAFORM_COMMAND_TRACE_FLOOR", version: "0.124.91", gates: "The first chant whose terraform lexicon's engine runs carry what a product's own command tracing read: `runBinary` and the engine runner's `exec` and `execSync` answer stderr apart (`Ran.stderr`) and a spawn failure's message (`Ran.error`), a hook's `after` gets a binary that could not be started as a null code with `error`, `commandTrace` ends that span with the message, and `composeCommandHooks` runs a product's own hook and `commandTrace` as one `onCommand` (#5007).", issue: "#5007", file: "release-floors.ts", modules: ["@intentius/chant/release-floors"] },
|
|
224
233
|
{ name: "RUN_EVENT_FLOOR", version: "0.124.28", gates: "The first chant that writes contract version 1 of the run-event stream.", file: "run-event.ts", modules: ["@intentius/chant","@intentius/chant/index","@intentius/chant/run-event"] },
|
|
225
234
|
{ name: "RUN_EVENT_FAILURE_FLOOR", version: "0.124.30", gates: "The first chant that writes `failure` on `run-settle` (#4094).", issue: "#4094", file: "run-event.ts", modules: ["@intentius/chant","@intentius/chant/index","@intentius/chant/run-event"] },
|
|
226
235
|
{ name: "RUN_EVENT_COMPONENT_SKIP_FLOOR", version: "0.124.29", gates: "The first chant that writes `blocked`, `already-applied` and `blockedBy` on `component-settle` (#4007).", issue: "#4007", file: "run-event.ts", modules: ["@intentius/chant","@intentius/chant/index","@intentius/chant/run-event"] },
|
package/src/lexicon-module.ts
CHANGED
|
@@ -243,11 +243,15 @@ export function packageNameOf(spec: string): string | undefined {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
/** True when `err` says the package `pkg` itself could not be found, not something it imports. */
|
|
246
|
-
function isPackageNotFound(err: unknown, pkg: string): boolean {
|
|
246
|
+
export function isPackageNotFound(err: unknown, pkg: string): boolean {
|
|
247
247
|
const code = (err as { code?: unknown } | null)?.code;
|
|
248
248
|
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") return false;
|
|
249
249
|
const message = err instanceof Error ? err.message : String(err);
|
|
250
|
-
|
|
250
|
+
// The specifier itself is quoted: `'pkg'`, or `'pkg/sub'` for a subpath.
|
|
251
|
+
// chant#4881 — a file missing inside an installed package is named by its
|
|
252
|
+
// path (`'/…/node_modules/pkg/generated/index.js'`), which is not quoted at
|
|
253
|
+
// the package name, so it doesn't count as the package being missing.
|
|
254
|
+
return [`'${pkg}'`, `"${pkg}"`, `'${pkg}/`, `"${pkg}/`].some((quoted) => message.includes(quoted));
|
|
251
255
|
}
|
|
252
256
|
|
|
253
257
|
/**
|
package/src/lexicon.ts
CHANGED
|
@@ -1231,6 +1231,46 @@ export interface OpWavesPipelineOptions
|
|
|
1231
1231
|
* target. On GitLab it posts with `CHANT_FORGE_TOKEN`.
|
|
1232
1232
|
*/
|
|
1233
1233
|
staleNotes?: { command: string; env: Record<string, string> };
|
|
1234
|
+
/**
|
|
1235
|
+
* A product's job names (#5022, `@intentius/chant/op/op-waves-names`): a
|
|
1236
|
+
* function that gives each job the generator writes (a wave's job, its
|
|
1237
|
+
* deciding, share and job group jobs, a split wave's plan, gate, apply
|
|
1238
|
+
* and record jobs, the policy and evidence jobs, the apply status, stale,
|
|
1239
|
+
* before-merge done and control jobs) the product's name, or undefined
|
|
1240
|
+
* for chant's. Every `needs:`, `if:`, `{job}` and `--from-job` follows
|
|
1241
|
+
* it. A name the forge cannot take, and two jobs that share one, are
|
|
1242
|
+
* refused. Absent: chant's names.
|
|
1243
|
+
*/
|
|
1244
|
+
jobNames?: import("./op/op-waves-names").OpWavesJobNames;
|
|
1245
|
+
/** GitLab (#5022): a product's stage names, as {@link jobNames}. Two stages may share one, such as terragucci's `apply`. Absent: chant's. */
|
|
1246
|
+
stageNames?: import("./op/op-waves-names").OpWavesStageNames;
|
|
1247
|
+
/** GitHub and Forgejo (#5022): the outcome, decision, saved plan and check claims artifacts' names, and the pattern a wave job downloads the earlier outcomes with. Absent: chant's. */
|
|
1248
|
+
artifactNames?: import("./op/op-waves-names").OpWavesArtifactNames;
|
|
1249
|
+
/**
|
|
1250
|
+
* GitHub and Forgejo (#5022): the workflow file the jobs go in, such as
|
|
1251
|
+
* `terragucci.yml`: the generator's file, and the one a rest wave's
|
|
1252
|
+
* record job dispatches. GitLab takes `opsFileName`. Absent: `<spec>.yml`.
|
|
1253
|
+
*/
|
|
1254
|
+
workflowFile?: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* The jobs go in a product's own workflow or pipeline beside its other
|
|
1257
|
+
* jobs (#5022). GitHub and Forgejo: an expression (without `${{ }}`)
|
|
1258
|
+
* for the push the waves run on, such as `github.ref ==
|
|
1259
|
+
* format('refs/heads/{0}', github.event.repository.default_branch)`;
|
|
1260
|
+
* each job runs only on such a push, or a before-merge or follow-on
|
|
1261
|
+
* dispatch of its own inputs, and carries its permissions itself. GitLab:
|
|
1262
|
+
* a condition joined with `&&` to every rule of every job. Absent: the
|
|
1263
|
+
* jobs are the workflow's own, as before.
|
|
1264
|
+
*/
|
|
1265
|
+
runIf?: string;
|
|
1266
|
+
/**
|
|
1267
|
+
* GitHub and Forgejo (#5022): the names of the `workflow_dispatch`
|
|
1268
|
+
* inputs `pr`, `head`, `digest` (before merge) and `wave`, `commit` (a
|
|
1269
|
+
* rest wave's follow-on), so they never meet the product's own, such as
|
|
1270
|
+
* a re-plan's `pr`. The comment job dispatches them by the same names
|
|
1271
|
+
* (`wavesBeforeMerge.dispatchInputs`). Absent: chant's.
|
|
1272
|
+
*/
|
|
1273
|
+
dispatchInputs?: Partial<Record<import("./op/op-waves-names").OpWavesDispatchInput, string>>;
|
|
1234
1274
|
}
|
|
1235
1275
|
|
|
1236
1276
|
/** A run step a product adds to a generated job (#4791): its name, and its shell lines in order. */
|
|
@@ -1264,7 +1304,8 @@ export interface OpWaveJobInputs {
|
|
|
1264
1304
|
report?: OpWaveRunStep;
|
|
1265
1305
|
/**
|
|
1266
1306
|
* Files the job keeps as an artifact whatever its exit. `{job}` in
|
|
1267
|
-
* `name` is the job's name
|
|
1307
|
+
* `name` is the job's name (#5022: the product's, under `jobNames`), so
|
|
1308
|
+
* a wide wave's jobs keep one each. GitHub
|
|
1268
1309
|
* and Forgejo: an upload step named `step` after the report. GitLab: the
|
|
1269
1310
|
* path joins the job's `artifacts:`, which keep the outcome files too,
|
|
1270
1311
|
* under `name`.
|
|
@@ -45,6 +45,8 @@ import type { BeforeMergeDecision, BeforeMergeRecord } from "./before-merge";
|
|
|
45
45
|
export interface WavesBeforeMergeJobs {
|
|
46
46
|
/** GitHub and Forgejo: the waves workflow's file, which the comment job dispatches. */
|
|
47
47
|
workflow?: string;
|
|
48
|
+
/** GitHub and Forgejo (#5022): the product's names of the dispatch inputs `pr`, `head` and `digest`, as the waves workflow takes them. Default chant's. */
|
|
49
|
+
inputs?: Partial<Record<"pr" | "head" | "digest", string>>;
|
|
48
50
|
/** The requires the forge is asked (`apply.requires`). Default every one. */
|
|
49
51
|
requires?: PrApplyRequire[];
|
|
50
52
|
/** The statuses that must have passed on the head: the product plan's `<product>/plan`, or one per target. */
|
|
@@ -87,12 +87,13 @@ export function opWavePolicyStepName(wave: number, name: string): string {
|
|
|
87
87
|
/**
|
|
88
88
|
* The evidence job's `CHANT_EVIDENCE_SOURCES`: on GitHub and Forgejo the
|
|
89
89
|
* command step for `plan:<wave>` and the policy step for `policy:<wave>`, by
|
|
90
|
-
* name; on GitLab the wave job and its policy job
|
|
90
|
+
* name; on GitLab the wave job and its policy job (`policyJob`, a
|
|
91
|
+
* product's name for it, #5022).
|
|
91
92
|
*/
|
|
92
|
-
export function opWaveEvidenceSources(forge: "github" | "forgejo" | "gitlab", plan: OpWaveEvidencePlan, job: Pick<OpWaveJob, "jobName" | "wave">, waveName: string, commandStep: string): Record<string, EvidenceSourceSpec> {
|
|
93
|
+
export function opWaveEvidenceSources(forge: "github" | "forgejo" | "gitlab", plan: OpWaveEvidencePlan, job: Pick<OpWaveJob, "jobName" | "wave">, waveName: string, commandStep: string, policyJob = opWavePolicyJobName(job)): Record<string, EvidenceSourceSpec> {
|
|
93
94
|
const out: Record<string, EvidenceSourceSpec> = {};
|
|
94
95
|
for (const check of plan.evidenceJob?.checks ?? []) {
|
|
95
|
-
if (forge === "gitlab") out[check] = check === plan.policy ? { job:
|
|
96
|
+
if (forge === "gitlab") out[check] = check === plan.policy ? { job: policyJob } : {};
|
|
96
97
|
else out[check] = { step: check === plan.policy ? opWavePolicyStepName(job.wave, waveName) : commandStep };
|
|
97
98
|
}
|
|
98
99
|
return out;
|
|
@@ -74,6 +74,8 @@ export interface OpWavesFollowOnTarget {
|
|
|
74
74
|
forge: "github" | "forgejo" | "gitlab";
|
|
75
75
|
/** GitHub and Forgejo: the waves workflow's file name, which the record job dispatches. */
|
|
76
76
|
workflow?: string;
|
|
77
|
+
/** GitHub and Forgejo (#5022): the product's names of the dispatch inputs `pr`, `head`, `digest`, `wave` and `commit`, when it renamed any. */
|
|
78
|
+
inputs?: Partial<Record<"pr" | "head" | "digest" | "wave" | "commit", string>>;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
/** The rest wave's number when the spec's last wave has `rest`, else undefined. */
|
|
@@ -107,7 +109,11 @@ export function parseFollowOnTarget(raw: string | undefined): OpWavesFollowOnTar
|
|
|
107
109
|
const o = v as Partial<OpWavesFollowOnTarget> | null;
|
|
108
110
|
if (!o || (o.forge !== "github" && o.forge !== "forgejo" && o.forge !== "gitlab")) throw new Error(`${OP_WAVES_FOLLOW_ON_ENV}.forge is github, forgejo or gitlab`);
|
|
109
111
|
if (o.forge !== "gitlab" && (typeof o.workflow !== "string" || !/^[A-Za-z0-9._-]+\.ya?ml$/.test(o.workflow))) throw new Error(`${OP_WAVES_FOLLOW_ON_ENV}.workflow names the waves workflow's file`);
|
|
110
|
-
|
|
112
|
+
const inputs = o.inputs;
|
|
113
|
+
if (inputs !== undefined && (typeof inputs !== "object" || inputs === null || Object.entries(inputs).some(([k, n]) => !["pr", "head", "digest", "wave", "commit"].includes(k) || typeof n !== "string" || !/^[A-Za-z_][A-Za-z0-9_-]*$/.test(n)))) {
|
|
114
|
+
throw new Error(`${OP_WAVES_FOLLOW_ON_ENV}.inputs names the dispatch inputs pr, head, digest, wave and commit`);
|
|
115
|
+
}
|
|
116
|
+
return { forge: o.forge, ...(o.workflow ? { workflow: o.workflow } : {}), ...(inputs ? { inputs: { ...inputs } } : {}) };
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
/**
|
|
@@ -380,6 +386,8 @@ export async function startFollowOn(target: OpWavesFollowOnTarget, wave: number,
|
|
|
380
386
|
}
|
|
381
387
|
const ref = env.GITHUB_REF_NAME?.trim() || env.GITHUB_REF?.replace(/^refs\/heads\//, "");
|
|
382
388
|
if (!ref) throw new Error("the job names no branch (no GITHUB_REF_NAME)");
|
|
383
|
-
|
|
389
|
+
// #5022: the inputs under the product's names, when it renamed them.
|
|
390
|
+
const inputs = Object.fromEntries(Object.entries(values).map(([k, v]) => [target.inputs?.[k as keyof NonNullable<OpWavesFollowOnTarget["inputs"]>] ?? k, v]));
|
|
391
|
+
await post(`${t.apiBase}/repos/${t.repo}/actions/workflows/${encodeURIComponent(target.workflow!)}/dispatches`, { Authorization: `token ${t.token}` }, { ref, inputs });
|
|
384
392
|
return {};
|
|
385
393
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #5022: a product's own names in an Op waves pipeline: the job names and
|
|
3
|
+
* their needs, the dispatch inputs and artifact names, the follow-on
|
|
4
|
+
* dispatch under the product's workflow and inputs, and the product
|
|
5
|
+
* pipeline's before-merge workflow and inputs.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, expect, test } from "vitest";
|
|
8
|
+
import { opWaveJobs, type OpWavesSpec } from "./op-waves";
|
|
9
|
+
import { opWaveSplitJobs } from "./op-waves-split";
|
|
10
|
+
import { opWavesArtifacts, opWavesDispatchInputs, opWavesInputsRenamed, opWavesNamer, opWavesWorkflowFile, type OpWavesJobRef } from "./op-waves-names";
|
|
11
|
+
import { parseFollowOnTarget, startFollowOn } from "./op-waves-follow-on";
|
|
12
|
+
import { productPipelineJobs } from "../components/product-pipeline";
|
|
13
|
+
|
|
14
|
+
const spec = {
|
|
15
|
+
name: "tf-apply",
|
|
16
|
+
op: "tf-apply",
|
|
17
|
+
planWave: ["terragucci", "plan-wave", "{runs}", "{plans}"],
|
|
18
|
+
apply: ["terragucci", "apply", "{target}", "--plan", "{plan}"],
|
|
19
|
+
waves: [
|
|
20
|
+
{ name: "canary", runs: [], discover: true },
|
|
21
|
+
{ name: "wide", runs: [], discover: true, shares: 2 },
|
|
22
|
+
{ name: "rest", runs: [], discover: true, rest: true },
|
|
23
|
+
],
|
|
24
|
+
} as unknown as OpWavesSpec;
|
|
25
|
+
|
|
26
|
+
const terragucci = (j: OpWavesJobRef): string | undefined => {
|
|
27
|
+
const w = j.rest ? "apply-rest" : `apply-wave-${j.wave}`;
|
|
28
|
+
if (j.role === "wave" || j.role === "decide") return w;
|
|
29
|
+
if (j.role === "share") return `${w}-share-${j.share}`;
|
|
30
|
+
if (j.role === "plan" || j.role === "gate" || j.role === "record") return `${w}-${j.role}`;
|
|
31
|
+
if (j.role === "apply") return j.share !== undefined ? `${w}-share-${j.share}` : w;
|
|
32
|
+
return undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe("the job names (#5022)", () => {
|
|
36
|
+
test("each job takes the product's name, and its needs follow", () => {
|
|
37
|
+
const jobs = opWavesNamer(spec, "github", terragucci).jobs(opWaveJobs(spec, "s.json"));
|
|
38
|
+
expect(jobs.map((j) => [j.jobName, j.needs])).toEqual([
|
|
39
|
+
["apply-wave-1", []],
|
|
40
|
+
["apply-wave-2", ["apply-wave-1"]],
|
|
41
|
+
["apply-wave-2-share-1", ["apply-wave-2"]],
|
|
42
|
+
["apply-wave-2-share-2", ["apply-wave-2"]],
|
|
43
|
+
["apply-rest", ["apply-wave-2-share-1", "apply-wave-2-share-2"]],
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("a split pipeline's jobs, and the rest wave's, take theirs", () => {
|
|
48
|
+
const split = opWavesNamer(spec, "github", terragucci).jobs(opWaveSplitJobs(spec, opWaveJobs(spec, "s.json", { beforeMerge: true })));
|
|
49
|
+
expect(split.filter((j) => j.wave === 3).map((j) => [j.jobName, j.needs])).toEqual([
|
|
50
|
+
["apply-rest-plan", ["apply-wave-2-record"]],
|
|
51
|
+
["apply-rest-gate", ["apply-rest-plan"]],
|
|
52
|
+
["apply-rest", ["apply-rest-gate"]],
|
|
53
|
+
["apply-rest-record", ["apply-rest", "apply-rest-gate"]],
|
|
54
|
+
]);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("without names, chant's; the same job asked twice keeps its name", () => {
|
|
58
|
+
const namer = opWavesNamer(spec, "gitlab", undefined);
|
|
59
|
+
expect(namer.jobs(opWaveJobs(spec, "s.json")).map((j) => j.jobName)).toEqual(["wave-1-canary", "wave-2-wide-decide", "wave-2-wide-share-1", "wave-2-wide-share-2", "wave-3-rest"]);
|
|
60
|
+
expect(namer.name({ role: "control", name: "control-dispatch" })).toBe("control-dispatch");
|
|
61
|
+
expect(namer.name({ role: "control", name: "control-dispatch" })).toBe("control-dispatch");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("refuses a name the forge cannot take, and two jobs that share one", () => {
|
|
65
|
+
const jobs = opWaveJobs(spec, "s.json");
|
|
66
|
+
expect(() => opWavesNamer(spec, "github", () => "1-apply").jobs(jobs)).toThrow(/not a job name/);
|
|
67
|
+
expect(() => opWavesNamer(spec, "gitlab", (j) => (j.role === "wave" ? "stages" : undefined)).jobs(jobs)).toThrow(/no GitLab keyword/);
|
|
68
|
+
expect(() => opWavesNamer(spec, "github", (j) => (j.role === "share" ? "apply" : undefined)).jobs(jobs)).toThrow(/names two jobs apply: wave-2-wide-share-1 and wave-2-wide-share-2/);
|
|
69
|
+
const namer = opWavesNamer(spec, "github", (j) => (j.role === "apply-status" ? "control-dispatch" : undefined));
|
|
70
|
+
namer.name({ role: "control", name: "control-dispatch" });
|
|
71
|
+
expect(() => namer.name({ role: "apply-status", name: "apply-status-1", wave: 1 })).toThrow(/names two jobs control-dispatch/);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("the dispatch inputs, artifacts and workflow file (#5022)", () => {
|
|
76
|
+
test("the inputs are chant's unless renamed, each a name and none twice", () => {
|
|
77
|
+
expect(opWavesDispatchInputs(undefined)).toEqual({ pr: "pr", head: "head", digest: "digest", wave: "wave", commit: "commit" });
|
|
78
|
+
expect(opWavesInputsRenamed(opWavesDispatchInputs({ pr: "pr" }))).toBe(false);
|
|
79
|
+
expect(opWavesDispatchInputs({ pr: "apply_pr", head: "apply_head" })).toMatchObject({ pr: "apply_pr", head: "apply_head", digest: "digest" });
|
|
80
|
+
expect(() => opWavesDispatchInputs({ pr: "head" })).toThrow(/names two inputs head: pr and head/);
|
|
81
|
+
expect(() => opWavesDispatchInputs({ pr: "a b" })).toThrow(/not an input name/);
|
|
82
|
+
expect(() => opWavesDispatchInputs({ root: "r" } as never)).toThrow(/none of pr, head, digest, wave and commit/);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("the artifacts are chant's unless named, each template holding its mark", () => {
|
|
86
|
+
const chant = opWavesArtifacts(spec, undefined);
|
|
87
|
+
expect([chant.outcome("wave-1-canary"), chant.decision(2), chant.plan(2), chant.checks("j"), chant.earlier]).toEqual(["tf-apply-wave-1-canary-outcome", "tf-apply-wave-2-decision", "tf-apply-wave-2-plan", "tf-apply-j-checks", undefined]);
|
|
88
|
+
const tg = opWavesArtifacts(spec, { outcome: "terragucci-report-{job}-outcome", decision: "terragucci-wave-{wave}", earlier: "terragucci-report-apply-wave-*" });
|
|
89
|
+
expect([tg.outcome("apply-wave-1"), tg.decision(2), tg.earlier]).toEqual(["terragucci-report-apply-wave-1-outcome", "terragucci-wave-2", "terragucci-report-apply-wave-*"]);
|
|
90
|
+
expect(() => opWavesArtifacts(spec, { outcome: "outcome" })).toThrow(/artifactNames\.outcome "outcome" holds \{job\}/);
|
|
91
|
+
expect(() => opWavesArtifacts(spec, { decision: "d/{wave}" })).toThrow(/artifactNames\.decision/);
|
|
92
|
+
expect(() => opWavesArtifacts(spec, { decision: "w-{wave}", plan: "w-{wave}" })).toThrow(/the decision and the saved plan one name/);
|
|
93
|
+
expect(() => opWavesArtifacts(spec, { earlier: "a/b" })).toThrow(/artifactNames\.earlier/);
|
|
94
|
+
expect(opWavesWorkflowFile(spec, undefined)).toBe("tf-apply.yml");
|
|
95
|
+
expect(opWavesWorkflowFile(spec, "terragucci.yml")).toBe("terragucci.yml");
|
|
96
|
+
expect(() => opWavesWorkflowFile(spec, ".github/workflows/terragucci.yml")).toThrow(/workflow file's name/);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("the follow-on under the product's workflow and inputs (#5022)", () => {
|
|
101
|
+
test("the record job dispatches the product's workflow with its input names", async () => {
|
|
102
|
+
const target = parseFollowOnTarget(JSON.stringify({ forge: "github", workflow: "terragucci.yml", inputs: opWavesDispatchInputs({ pr: "apply_pr", head: "apply_head", digest: "apply_digest", wave: "apply_wave", commit: "apply_commit" }) }))!;
|
|
103
|
+
const posts: Array<{ url: string; body: unknown }> = [];
|
|
104
|
+
const fetchFn = (async (url: string, init: { body: string }) => (posts.push({ url, body: JSON.parse(init.body) }), new Response(null, { status: 204 }))) as unknown as typeof fetch;
|
|
105
|
+
const HEAD = "a".repeat(40);
|
|
106
|
+
const env = { GITHUB_REPOSITORY: "acme/infra", GITHUB_API_URL: "https://api.github.com", GITHUB_REF_NAME: "main", CHANT_WAVES_FOLLOW_ON_TOKEN: "t" };
|
|
107
|
+
await startFollowOn(target, 4, { ...env, CHANT_BEFORE_MERGE_PR: "7", CHANT_BEFORE_MERGE_HEAD: HEAD, CHANT_BEFORE_MERGE_DIGEST: `sha256:${"e".repeat(64)}` }, fetchFn);
|
|
108
|
+
expect(posts.at(-1)).toEqual({ url: "https://api.github.com/repos/acme/infra/actions/workflows/terragucci.yml/dispatches", body: { ref: "main", inputs: { apply_pr: "7", apply_head: HEAD, apply_digest: `sha256:${"e".repeat(64)}`, apply_wave: "4" } } });
|
|
109
|
+
await startFollowOn(target, 4, { ...env, CHANT_WAVES_COMMIT: "d".repeat(40) }, fetchFn);
|
|
110
|
+
expect(posts.at(-1)!.body).toEqual({ ref: "main", inputs: { apply_wave: "4", apply_commit: "d".repeat(40) } });
|
|
111
|
+
expect(() => parseFollowOnTarget(JSON.stringify({ forge: "github", workflow: "x.yml", inputs: { root: "r" } }))).toThrow(/inputs names the dispatch inputs/);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe("the product pipeline's waves before merge in a product's workflow (#5022)", () => {
|
|
116
|
+
const words = { product: "terragucci", noun: ["root", "roots"] as [string, string], commands: { plan: "plan" as const, apply: "apply" as const }, approval: "per-wave" as const, op: "tf-apply", bin: "terragucci" };
|
|
117
|
+
const waves = { name: "tf-apply", op: "tf-apply", step: { kind: "terraform-apply", root: "{target}" }, waves: [{ name: "dev", runs: [{ target: "envs/dev" }] }] } as OpWavesSpec;
|
|
118
|
+
const productPlan = { command: "terragucci plan --out {output}" };
|
|
119
|
+
|
|
120
|
+
test("the comment job dispatches the product's workflow by its input names, and the generator is handed both", () => {
|
|
121
|
+
const dispatchInputs = { pr: "apply_pr", head: "apply_head", digest: "apply_digest" };
|
|
122
|
+
const jobs = productPipelineJobs("github", "default", { words, waves, productPlan, commentJob: true, wavesBeforeMerge: { workflowFile: "terragucci.yml", dispatchInputs } });
|
|
123
|
+
expect(jobs.comment!.jobs.wavesBeforeMerge).toMatchObject({ workflow: "terragucci.yml", inputs: dispatchInputs });
|
|
124
|
+
expect(jobs.waves!.pipeline).toMatchObject({ workflowFile: "terragucci.yml", dispatchInputs });
|
|
125
|
+
const chant = productPipelineJobs("github", "default", { words, waves, productPlan, commentJob: true, wavesBeforeMerge: {} });
|
|
126
|
+
expect(chant.comment!.jobs.wavesBeforeMerge!.workflow).toBe("tf-apply.yml");
|
|
127
|
+
expect(chant.comment!.jobs.wavesBeforeMerge!.inputs).toBeUndefined();
|
|
128
|
+
expect(chant.waves!.pipeline.workflowFile).toBeUndefined();
|
|
129
|
+
expect(() => productPipelineJobs("gitlab", "default", { words, waves, productPlan: { ...productPlan, replan: true }, noteCommands: true, wavesBeforeMerge: { workflowFile: "terragucci.yml" } })).toThrow(/GitLab's note poll starts a pipeline with variables/);
|
|
130
|
+
});
|
|
131
|
+
});
|