@intentius/chant 0.124.87 → 0.124.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-pins.d.ts +1 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +2 -0
- package/dist/actor.d.ts +47 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +56 -0
- package/dist/bundle-check.d.ts +20 -5
- package/dist/bundle-check.d.ts.map +1 -1
- package/dist/bundle-check.js +20 -5
- package/dist/chant-install.d.ts +98 -0
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +203 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-commit.d.ts +1 -1
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +1 -2
- package/dist/ci-control.d.ts +1 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +1 -1
- package/dist/ci-evidence-claims.d.ts +59 -0
- package/dist/ci-evidence-claims.d.ts.map +1 -0
- package/dist/ci-evidence-claims.js +87 -0
- package/dist/ci-evidence-from-job.d.ts +128 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -0
- package/dist/ci-evidence-from-job.js +203 -0
- package/dist/ci-evidence-jobs.d.ts +68 -4
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +82 -5
- package/dist/ci-handover.d.ts +12 -0
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +15 -3
- package/dist/ci-identity.d.ts +32 -6
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +40 -8
- package/dist/ci-image.d.ts +65 -10
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +101 -22
- package/dist/ci-jobs.d.ts +1 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -2
- package/dist/ci-login.d.ts +75 -13
- package/dist/ci-login.d.ts.map +1 -1
- package/dist/ci-login.js +89 -37
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +62 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +52 -1
- package/dist/ci-product.d.ts +52 -2
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +51 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve-confirm.d.ts +14 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
- package/dist/cli/handlers/approve-confirm.js +46 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -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 +37 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +255 -20
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-forge-check.js +34 -17
- 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 +11 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -0
- package/dist/cli/handlers/generated-check.js +71 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +3 -0
- package/dist/cli/handlers/local-chant.d.ts +13 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -1
- package/dist/cli/handlers/local-chant.js +42 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +97 -14
- 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 +36 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +60 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +82 -0
- package/dist/cli/registry.d.ts +35 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/check-hooks.d.ts +10 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +18 -0
- package/dist/components/pr-checks.d.ts +169 -0
- package/dist/components/pr-checks.d.ts.map +1 -0
- package/dist/components/pr-checks.js +180 -0
- package/dist/components/pr-pipeline.d.ts +38 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +6 -1
- package/dist/components/product-pipeline.d.ts +58 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +76 -9
- package/dist/components/product-plan.d.ts +445 -7
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +426 -15
- package/dist/config.d.ts +10 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/control/consumers.d.ts +6 -0
- package/dist/control/consumers.d.ts.map +1 -1
- package/dist/control/consumers.js +6 -0
- package/dist/dead-guards.d.ts.map +1 -1
- package/dist/dead-guards.js +9 -6
- package/dist/discovery/files.d.ts +1 -1
- package/dist/discovery/files.js +1 -1
- package/dist/drift-issue.d.ts +20 -3
- package/dist/drift-issue.d.ts.map +1 -1
- package/dist/drift-issue.js +16 -0
- package/dist/drift-record.d.ts +52 -5
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +46 -6
- package/dist/floor-table.d.ts +6 -6
- package/dist/floor-table.d.ts.map +1 -1
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +81 -21
- package/dist/floor-table.js +10 -7
- package/dist/forge-check/contract.d.ts +19 -1
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +8 -2
- package/dist/forge-check/index.d.ts +4 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +4 -0
- package/dist/forge-flags.d.ts +10 -0
- package/dist/forge-flags.d.ts.map +1 -1
- package/dist/forge-flags.js +31 -0
- package/dist/forge-remote.d.ts +47 -0
- package/dist/forge-remote.d.ts.map +1 -0
- package/dist/forge-remote.js +69 -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 +88 -0
- package/dist/generated-check.d.ts.map +1 -0
- package/dist/generated-check.js +248 -0
- 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 +27 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +26 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +76 -4
- 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 +22 -1
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +26 -3
- package/dist/lifecycle/release-ledger.d.ts +4 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +3 -2
- package/dist/local-chant.d.ts +57 -3
- package/dist/local-chant.d.ts.map +1 -1
- package/dist/local-chant.js +122 -13
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +97 -0
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-jobs.js +118 -0
- package/dist/op/op-waves-evidence.d.ts +12 -1
- package/dist/op/op-waves-evidence.d.ts.map +1 -1
- package/dist/op/op-waves-evidence.js +23 -2
- 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 +14 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +56 -4
- package/dist/op/op-waves.d.ts +12 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +14 -1
- package/dist/op/schedule-overdue.d.ts +39 -2
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +148 -10
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-forge-reads.d.ts +21 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +19 -1
- package/dist/pr-forge.d.ts +7 -1
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +7 -2
- 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 +121 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +104 -1
- package/dist/pr-plan-record.d.ts +47 -0
- package/dist/pr-plan-record.d.ts.map +1 -0
- package/dist/pr-plan-record.js +89 -0
- package/dist/pr-post.d.ts +68 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +218 -13
- package/dist/pr-requires.d.ts +8 -0
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +3 -1
- 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 +90 -0
- package/dist/ref-gate-init.d.ts.map +1 -0
- package/dist/ref-gate-init.js +155 -0
- package/dist/ref-gate-rules.d.ts +19 -0
- package/dist/ref-gate-rules.d.ts.map +1 -0
- package/dist/ref-gate-rules.js +17 -0
- package/dist/release-floors.d.ts +100 -16
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +101 -17
- 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 +24 -1
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +39 -4
- package/dist/state-unlock.d.ts +32 -1
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +31 -0
- package/dist/wave-runtime.mjs +307 -297
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +15 -8
- package/dist/workspace/drift-cli.d.ts +1 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +5 -12
- package/dist/workspace/forge-work.d.ts +3 -2
- package/dist/workspace/forge-work.d.ts.map +1 -1
- package/dist/workspace/forge-work.js +7 -17
- package/dist/workspace/lexicon-outputs.js +2 -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 +27 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +52 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +25 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +28 -8
- package/dist/workspace/trust/check-evidence.d.ts +13 -1
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence.js +8 -3
- package/dist/workspace/trust/evidence.d.ts +5 -0
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/evidence.js +5 -0
- package/dist/workspace/trust/open-evidence.d.ts +67 -0
- package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/open-evidence.js +92 -0
- 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 +93 -11
- package/dist/workspace/trust/ref-gate.d.ts +61 -2
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate.js +72 -7
- 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/action-pins.ts +2 -0
- package/src/actor.test.ts +78 -0
- package/src/actor.ts +79 -0
- package/src/bundle-check.test.ts +22 -0
- package/src/bundle-check.ts +33 -5
- package/src/chant-install.test.ts +108 -1
- package/src/chant-install.ts +242 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +51 -6
- package/src/ci-commit.ts +1 -2
- package/src/ci-control.ts +1 -0
- package/src/ci-evidence-claims.ts +102 -0
- package/src/ci-evidence-from-job.test.ts +165 -0
- package/src/ci-evidence-from-job.ts +251 -0
- package/src/ci-evidence-jobs.ts +88 -6
- package/src/ci-handover.ts +16 -3
- package/src/ci-identity.test.ts +3 -3
- package/src/ci-identity.ts +51 -11
- package/src/ci-image.test.ts +187 -16
- package/src/ci-image.ts +157 -25
- package/src/ci-jobs.ts +7 -2
- package/src/ci-login.test.ts +131 -3
- package/src/ci-login.token-drop.test.ts +204 -0
- package/src/ci-login.ts +137 -39
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +89 -0
- package/src/ci-product.ts +62 -1
- package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve-confirm.test.ts +35 -0
- package/src/cli/handlers/approve-confirm.ts +44 -0
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/build-source-dir.test.ts +4 -0
- package/src/cli/handlers/build.ts +20 -2
- package/src/cli/handlers/ci-check.ts +37 -7
- package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
- package/src/cli/handlers/ci-evidence.ts +233 -18
- package/src/cli/handlers/ci-forge-check.ts +22 -9
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +69 -0
- package/src/cli/handlers/lifecycle.test.ts +20 -0
- package/src/cli/handlers/lifecycle.ts +4 -0
- package/src/cli/handlers/local-chant.ts +39 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +93 -15
- 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 +35 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +60 -4
- package/src/cli/parse-args.ts +58 -0
- package/src/cli/registry.ts +35 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/check-hooks.ts +22 -0
- package/src/components/check-report-summary.test.ts +78 -0
- package/src/components/pr-checks.ts +254 -0
- package/src/components/pr-pipeline.ts +43 -1
- package/src/components/product-pipeline.ts +113 -9
- package/src/components/product-plan.test.ts +140 -1
- package/src/components/product-plan.ts +707 -20
- package/src/config.ts +13 -8
- package/src/control/consumers.ts +7 -0
- package/src/dead-guards.test.ts +27 -5
- package/src/dead-guards.ts +9 -6
- package/src/discovery/files.ts +1 -1
- package/src/drift-issue.test.ts +29 -1
- package/src/drift-issue.ts +28 -3
- package/src/drift-record.test.ts +45 -0
- package/src/drift-record.ts +71 -6
- package/src/floor-table.data.ts +81 -21
- package/src/floor-table.ts +12 -9
- package/src/forge-check/contract.ts +23 -2
- package/src/forge-check/forge-check.test.ts +25 -0
- package/src/forge-check/index.ts +4 -0
- package/src/forge-flags.test.ts +25 -1
- package/src/forge-flags.ts +34 -0
- package/src/forge-remote.test.ts +37 -0
- package/src/forge-remote.ts +79 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +118 -0
- package/src/generated-check.test.ts +170 -0
- package/src/generated-check.ts +310 -0
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +28 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +87 -4
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-catalog.test.ts +2 -2
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
- package/src/lifecycle/release-images.test.ts +100 -0
- package/src/lifecycle/release-images.ts +38 -3
- package/src/lifecycle/release-ledger.ts +4 -3
- package/src/local-chant.e2e.test.ts +81 -6
- package/src/local-chant.test.ts +22 -3
- package/src/local-chant.ts +130 -13
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +140 -0
- package/src/op/op-waves-evidence.test.ts +36 -3
- package/src/op/op-waves-evidence.ts +23 -3
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +59 -3
- package/src/op/op-waves.ts +16 -2
- package/src/op/schedule-overdue.test.ts +126 -1
- package/src/op/schedule-overdue.ts +164 -12
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-forge-reads-compare.test.ts +2 -1
- package/src/pr-forge-reads.ts +37 -1
- package/src/pr-forge.ts +14 -3
- 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 +184 -3
- package/src/pr-plan-record.test.ts +75 -0
- package/src/pr-plan-record.ts +101 -0
- package/src/pr-post-plan-note.test.ts +60 -0
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +32 -1
- package/src/pr-post.ts +254 -15
- package/src/pr-requires.test.ts +20 -0
- package/src/pr-requires.ts +10 -1
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +208 -0
- package/src/ref-gate-rules.ts +26 -0
- package/src/release-floors.ts +139 -17
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +89 -0
- package/src/state-migration.test.ts +1 -1
- package/src/state-migration.ts +52 -4
- package/src/state-unlock.test.ts +33 -1
- package/src/state-unlock.ts +49 -1
- package/src/workspace/ci-green-cli.ts +14 -7
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/drift-cli.ts +6 -18
- package/src/workspace/forge-work.ts +7 -14
- package/src/workspace/lexicon-outputs.ts +2 -2
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +104 -3
- package/src/workspace/release-workflow.ts +60 -9
- package/src/workspace/trust/check-evidence-report.ts +39 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/check-evidence.ts +17 -5
- package/src/workspace/trust/evidence.ts +5 -0
- package/src/workspace/trust/open-evidence.ts +129 -0
- package/src/workspace/trust/ref-gate-cli.ts +88 -10
- package/src/workspace/trust/ref-gate-pieces.test.ts +220 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/trust/ref-gate.ts +87 -6
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
* renders the tag-triggered file it always did.
|
|
29
29
|
*/
|
|
30
30
|
import { ACTION_PINS, tagComments, usesRef } from "../action-pins";
|
|
31
|
-
import {
|
|
31
|
+
import { IMAGE_PINS, imageRef } from "../image-pins";
|
|
32
|
+
import { releaseImagePlatforms, resolveReleaseImages } from "../lifecycle/release-images";
|
|
32
33
|
import { GENERATED_MARKER } from "../discovery/files";
|
|
33
34
|
import type { SecurityGroup } from "./security";
|
|
34
35
|
import type { OpSetupStep } from "../lexicon";
|
|
@@ -74,9 +75,9 @@ export interface ReleasePipelineConfig {
|
|
|
74
75
|
env?: Record<string, string>;
|
|
75
76
|
/**
|
|
76
77
|
* Steps the cut and publish jobs run after the install (#4751): `{ run }`,
|
|
77
|
-
* or `{ uses, with }` on GitHub and Forgejo, such as
|
|
78
|
-
*
|
|
79
|
-
*
|
|
78
|
+
* or `{ uses, with }` on GitHub and Forgejo, such as a newer npm. GitLab
|
|
79
|
+
* takes `run` steps as script lines and refuses `uses` by name. QEMU for
|
|
80
|
+
* the platforms `release.images` builds is set up without one (#4876).
|
|
80
81
|
*/
|
|
81
82
|
setup?: OpSetupStep[];
|
|
82
83
|
/** Where the workflow is written, from the repository root, such as `.github/workflows/publish.yml` for an npm trusted publisher that names that file. Default {@link RELEASE_WORKFLOW_FILES}. */
|
|
@@ -107,6 +108,12 @@ export interface ReleaseWorkflowInput {
|
|
|
107
108
|
* two jobs cannot change what is published.
|
|
108
109
|
*/
|
|
109
110
|
imageArchives?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* The platforms `release.images` builds (#4876). Those the runner can't run
|
|
113
|
+
* ({@link RELEASE_RUNNER_PLATFORM}) get QEMU's binfmt handlers in the cut
|
|
114
|
+
* and publish jobs, before `release.workflow.setup`.
|
|
115
|
+
*/
|
|
116
|
+
imagePlatforms?: string[];
|
|
110
117
|
/** `release.lane` (#4692): the gate's green lane. */
|
|
111
118
|
lane?: string;
|
|
112
119
|
/**
|
|
@@ -174,6 +181,36 @@ export function targetExtras(forge: ReleaseWorkflowForge, targets: ReadonlyArray
|
|
|
174
181
|
return { ...(permissions ? { permissions } : {}), ...(Object.keys(env).length > 0 ? { env } : {}), ...(setup.length > 0 ? { setup } : {}) };
|
|
175
182
|
}
|
|
176
183
|
|
|
184
|
+
/** The platform the jobs `chant release workflow` writes run on: GitHub's and Forgejo's `ubuntu-latest`, and a GitLab runner's default (#4876). */
|
|
185
|
+
export const RELEASE_RUNNER_PLATFORM = "linux/amd64";
|
|
186
|
+
|
|
187
|
+
/** The binfmt image a GitLab job installs QEMU's handlers with (#4876): the repository, which a config's own setup line is recognised by. */
|
|
188
|
+
export const RELEASE_BINFMT_IMAGE = IMAGE_PINS.binfmt.repository;
|
|
189
|
+
|
|
190
|
+
/** The architectures among `platforms` the runner can't run, as QEMU names them (`linux/arm/v7` is `arm`), each once. */
|
|
191
|
+
export function qemuArchitectures(platforms: readonly string[]): string[] {
|
|
192
|
+
return [...new Set(platforms.filter((p) => p.split("/").slice(0, 2).join("/") !== RELEASE_RUNNER_PLATFORM).map((p) => p.split("/")[1] ?? p))].sort();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* QEMU's binfmt setup for the platforms `release.images` builds that the
|
|
197
|
+
* runner can't, such as `linux/arm64` on an amd64 runner (#4876), so no
|
|
198
|
+
* product names it in `release.workflow.setup`. GitHub and Forgejo get
|
|
199
|
+
* `docker/setup-qemu-action` at its pin; GitLab a `docker run --privileged`
|
|
200
|
+
* of {@link RELEASE_BINFMT_IMAGE} by the digest `IMAGE_PINS.binfmt` records
|
|
201
|
+
* (#4941, ../image-pins.ts), which `chant release workflow` notes needs
|
|
202
|
+
* an executor that runs privileged containers. A config whose `setup` names
|
|
203
|
+
* the action or the binfmt image already gets nothing more, so its file
|
|
204
|
+
* renders as it did.
|
|
205
|
+
*/
|
|
206
|
+
export function qemuSetup(forge: ReleaseWorkflowForge, platforms: readonly string[], p: ReleasePipelineConfig): OpSetupStep[] {
|
|
207
|
+
const archs = qemuArchitectures(platforms);
|
|
208
|
+
if (archs.length === 0) return [];
|
|
209
|
+
const named = (p.setup ?? []).some((s) => ("uses" in s ? /^docker\/setup-qemu-action@/.test(s.uses) : s.run.includes(RELEASE_BINFMT_IMAGE)));
|
|
210
|
+
if (named) return [];
|
|
211
|
+
return forge === "gitlab" ? [{ run: `docker run --privileged --rm ${imageRef(IMAGE_PINS.binfmt)} --install ${archs.join(",")}` }] : [{ uses: usesRef(ACTION_PINS.dockerSetupQemu4), with: { platforms: archs.join(",") } }];
|
|
212
|
+
}
|
|
213
|
+
|
|
177
214
|
/** The flags `chant release publish` gets under the groups. */
|
|
178
215
|
export function publishFlags(groups: ReadonlySet<SecurityGroup>): string[] {
|
|
179
216
|
return [...(groups.has("supply-chain") ? ["--require-provenance"] : []), "--yes"];
|
|
@@ -214,12 +251,14 @@ export function renderReleaseWorkflow(input: ReleaseWorkflowInput): string {
|
|
|
214
251
|
const version = input.version === true;
|
|
215
252
|
// #4786: the targets' own needs first, then the config's, so a config that set them by hand renders the same file without them.
|
|
216
253
|
const derived = targetExtras(input.forge, input.publish ?? [], p);
|
|
254
|
+
// #4876: QEMU before the config's setup, where the products named it.
|
|
255
|
+
const qemu = images ? qemuSetup(input.forge, input.imagePlatforms ?? [], p) : [];
|
|
217
256
|
const extra = jobExtras(
|
|
218
257
|
{
|
|
219
258
|
...p,
|
|
220
259
|
...(derived.permissions ? { permissions: { ...p.permissions, ...derived.permissions } } : {}),
|
|
221
260
|
...(derived.env ? { env: { ...p.env, ...derived.env } } : {}),
|
|
222
|
-
...(derived.setup ? { setup: [...(p.setup ?? []), ...derived.setup] } : {}),
|
|
261
|
+
...(derived.setup || qemu.length > 0 ? { setup: [...qemu, ...(p.setup ?? []), ...(derived.setup ?? [])] } : {}),
|
|
223
262
|
},
|
|
224
263
|
input.forge,
|
|
225
264
|
);
|
|
@@ -347,11 +386,14 @@ function jobExtras(p: ReleasePipelineConfig, forge: ReleaseWorkflowForge): JobEx
|
|
|
347
386
|
if (!/^[a-z][a-z-]*$/.test(k) || (v !== "read" && v !== "write")) throw new Error(`${where}.permissions: ${k}: ${String(v)} is not a scope and read or write`);
|
|
348
387
|
}
|
|
349
388
|
for (const s of setup) if (!("uses" in s) && s.run.trim() === "") throw new Error(`${where}.setup: a run step is empty`);
|
|
389
|
+
for (const s of setup) if (s.name !== undefined && (s.name.trim() === "" || /[\r\n]/.test(s.name))) throw new Error(`${where}.setup: a step's name is blank or more than one line`);
|
|
350
390
|
}
|
|
351
391
|
const q = (v: string | number | boolean): string => JSON.stringify(v);
|
|
352
392
|
const map = (indent: string, entries: Array<[string, string | number | boolean]>): string[] => entries.map(([k, v]) => `${indent}${k}: ${q(v)}`);
|
|
393
|
+
// #4932: a named step opens with its name.
|
|
353
394
|
const githubSteps = setup.flatMap((s) => [
|
|
354
|
-
|
|
395
|
+
...(s.name !== undefined ? [` - name: ${q(s.name)}`] : []),
|
|
396
|
+
` ${s.name !== undefined ? " " : "-"} ${"uses" in s ? `uses: ${s.uses}` : `run: ${q(s.run)}`}`,
|
|
355
397
|
...("uses" in s && s.with && Object.keys(s.with).length > 0 ? [" with:", ...map(" ", Object.entries(s.with))] : []),
|
|
356
398
|
...(s.env && Object.keys(s.env).length > 0 ? [" env:", ...map(" ", Object.entries(s.env))] : []),
|
|
357
399
|
]);
|
|
@@ -664,7 +706,7 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
664
706
|
groups,
|
|
665
707
|
workspaceRoot,
|
|
666
708
|
...(release?.workflow ? { pipeline: release.workflow } : {}),
|
|
667
|
-
...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release!.images!).map((i) => i.archive) } : {}),
|
|
709
|
+
...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release!.images!).map((i) => i.archive), imagePlatforms: releaseImagePlatforms(release!.images!) } : {}),
|
|
668
710
|
...(release?.lane ? { lane: release.lane } : {}),
|
|
669
711
|
...(release?.version ? { version: true } : {}),
|
|
670
712
|
...(release?.publish ? { publish: release.publish } : {}),
|
|
@@ -672,12 +714,17 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
672
714
|
...(args.buildCommand ? { build: args.buildCommand } : {}),
|
|
673
715
|
...(args.ciChant ? { chant: args.ciChant } : {}),
|
|
674
716
|
});
|
|
675
|
-
|
|
717
|
+
// #4909: under `chant dev generated-check` the header names the committed file the render stands for.
|
|
718
|
+
// #4950: with no --output the file goes to the render tree too, so a render needs no `--output {out}/...`.
|
|
719
|
+
const { committedPathOf, isRenderPath, renderPathOf } = await import("../generated-check");
|
|
720
|
+
const defaultTarget = join(repoRoot, release?.workflow?.file ?? RELEASE_WORKFLOW_FILES[forge]);
|
|
721
|
+
const target = args.output ? resolve(process.cwd(), args.output) : renderPathOf(defaultTarget);
|
|
722
|
+
const asCommitted = committedPathOf(target);
|
|
676
723
|
const parts = ["chant", "release", "workflow", "--forge", forge];
|
|
677
724
|
if (args.ciInstall) parts.push("--install", args.ciInstall);
|
|
678
725
|
if (args.buildCommand) parts.push("--build", args.buildCommand);
|
|
679
726
|
if (args.ciChant) parts.push("--chant", args.ciChant);
|
|
680
|
-
if (args.output) parts.push("--output", relative(root,
|
|
727
|
+
if (args.output && !(isRenderPath(target) && asCommitted === defaultTarget)) parts.push("--output", relative(root, asCommitted).split(sep).join("/"));
|
|
681
728
|
mkdirSync(dirname(target), { recursive: true });
|
|
682
729
|
writeFileSync(target, releaseWorkflowHeader(parts.map(shellArg).join(" ")) + text);
|
|
683
730
|
const shown = relative(process.cwd(), target).split(sep).join("/") || target;
|
|
@@ -685,6 +732,10 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
685
732
|
const what = release?.workflow?.trigger === "dispatch" ? "cuts and publishes a release started by hand with its label, from a green commit" : "publishes the release a release/** tag names";
|
|
686
733
|
console.log(formatSuccess(`Wrote ${shown}: ${what}${extras.length > 0 ? `, and ${extras.join(" and ")}` : ""}.`));
|
|
687
734
|
if (forge === "gitlab") console.log(`Include it from .gitlab-ci.yml: include: [{ local: ${release?.workflow?.file ?? RELEASE_WORKFLOW_FILES.gitlab} }]`);
|
|
735
|
+
// #4876: a GitLab executor that refuses privileged containers can't install the handlers from the job.
|
|
736
|
+
const archs = (release?.images?.length ?? 0) > 0 ? qemuArchitectures(releaseImagePlatforms(release!.images!)) : [];
|
|
737
|
+
if (forge === "gitlab" && archs.length > 0 && text.includes(`${RELEASE_BINFMT_IMAGE} --install`))
|
|
738
|
+
console.log(`The cut and publish jobs install QEMU's binfmt handlers for ${archs.join(", ")} with docker run --privileged ${RELEASE_BINFMT_IMAGE}: the runner's executor must run privileged containers, or have the handlers installed on its host.`);
|
|
688
739
|
if (forge === "gitlab" && release?.workflow?.trigger === "dispatch") console.log("The cut and publish jobs push with CHANT_RELEASE_TOKEN: a project access token with write_repository, as a masked CI/CD variable.");
|
|
689
740
|
return 0;
|
|
690
741
|
}
|
|
@@ -76,27 +76,58 @@ function policyOf(dir: string): { passed: boolean; reason: string } | null {
|
|
|
76
76
|
return standing === 0 ? { passed: true, reason: "the policy denied nothing that stands" } : { passed: false, reason: `the policy denied ${standing} unit${standing === 1 ? "" : "s"} with no override` };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The checks to sign from the plan job's hand-off directory and result, and
|
|
81
|
+
* those left unsigned with why. #4964: a workspace member's plan job plans
|
|
82
|
+
* that member alone, so with `member` the two are `plan:<member>` and
|
|
83
|
+
* `policy:<member>`.
|
|
84
|
+
*/
|
|
85
|
+
export function planReportChecks(dir: string, result: string | undefined, member?: string): { sign: Array<{ check: string; claim?: Buffer }>; skipped: CheckEvidenceNote["skipped"] } {
|
|
86
|
+
const planCheck = member ? `plan:${member}` : "plan";
|
|
87
|
+
const policyCheck = member ? `policy:${member}` : "policy";
|
|
81
88
|
const file = [REPORT_FILE, HANDOFF_FILE].map((f) => join(dir, f)).find((f) => existsSync(f));
|
|
82
89
|
if (result !== "success") {
|
|
83
90
|
const why = `the plan job's result is ${result ?? "not given"}`;
|
|
84
|
-
return { sign: [], skipped: [{ check:
|
|
91
|
+
return { sign: [], skipped: [{ check: planCheck, reason: why }, { check: policyCheck, reason: why }] };
|
|
85
92
|
}
|
|
86
93
|
if (!file) {
|
|
87
94
|
const why = `the plan job left no ${REPORT_FILE} or ${HANDOFF_FILE}`;
|
|
88
|
-
return { sign: [], skipped: [{ check:
|
|
95
|
+
return { sign: [], skipped: [{ check: planCheck, reason: why }, { check: policyCheck, reason: why }] };
|
|
89
96
|
}
|
|
90
97
|
const claim = readFileSync(file);
|
|
91
|
-
const sign: Array<{ check: string; claim?: Buffer }> = [{ check:
|
|
98
|
+
const sign: Array<{ check: string; claim?: Buffer }> = [{ check: planCheck, claim }];
|
|
92
99
|
const skipped: CheckEvidenceNote["skipped"] = [];
|
|
93
100
|
const policy = policyOf(dir);
|
|
94
|
-
if (policy === null) skipped.push({ check:
|
|
95
|
-
else if (policy.passed) sign.push({ check:
|
|
96
|
-
else skipped.push({ check:
|
|
101
|
+
if (policy === null) skipped.push({ check: policyCheck, reason: "the plan ran no policy" });
|
|
102
|
+
else if (policy.passed) sign.push({ check: policyCheck, claim });
|
|
103
|
+
else skipped.push({ check: policyCheck, reason: policy.reason });
|
|
97
104
|
return { sign, skipped };
|
|
98
105
|
}
|
|
99
106
|
|
|
107
|
+
/**
|
|
108
|
+
* What a GitLab signing job in the target branch's pipeline keeps for one
|
|
109
|
+
* merge request (#4914), `<out>/<iid>/evidence.json`: the note, with the
|
|
110
|
+
* merge request and the head it was signed for, so the note job uses it
|
|
111
|
+
* only for that head.
|
|
112
|
+
*/
|
|
113
|
+
export interface OpenEvidenceFile extends CheckEvidenceNote {
|
|
114
|
+
pr: number;
|
|
115
|
+
head: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The `evidence.json` the signing job kept for merge request `pr` at
|
|
120
|
+
* `head` under `dir` (#4914), as text for the note job's report directory,
|
|
121
|
+
* or undefined when it kept none for that head. The file comes from a job
|
|
122
|
+
* of the same target-branch pipeline, which ran none of the change's code;
|
|
123
|
+
* it is read as data all the same.
|
|
124
|
+
*/
|
|
125
|
+
export function openEvidenceFor(dir: string, pr: number, head: string): string | undefined {
|
|
126
|
+
const doc = readJson(join(dir, String(pr), CHECK_EVIDENCE_FILE)) as Partial<OpenEvidenceFile> | undefined;
|
|
127
|
+
if (!doc || doc.pr !== pr || doc.head !== head || !Array.isArray(doc.signed) || !Array.isArray(doc.skipped)) return undefined;
|
|
128
|
+
return JSON.stringify({ signed: doc.signed, skipped: doc.skipped }, null, 2) + "\n";
|
|
129
|
+
}
|
|
130
|
+
|
|
100
131
|
/**
|
|
101
132
|
* The line the plan note ends with when the signing step wrote
|
|
102
133
|
* {@link CHECK_EVIDENCE_FILE} in `dir`, or undefined when it did not.
|
|
@@ -120,6 +120,11 @@ describe("the plan job's two checks (#4870)", () => {
|
|
|
120
120
|
expect(planReportChecks(dir(handoff([{ member: "a", rules: ["r"], overriders: [] }])), "success").sign.map((c) => c.check)).toEqual(["plan"]);
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
+
test("a workspace member's plan job signs its checks under the member's name (#4964)", () => {
|
|
124
|
+
expect(planReportChecks(dir({ "pr-plan.json": { policy: { result: "passed" } } }), "success", "app").sign.map((c) => c.check)).toEqual(["plan:app", "policy:app"]);
|
|
125
|
+
expect(planReportChecks(dir({ "pr-plan.json": {} }), "failure", "app").skipped.map((s) => s.check)).toEqual(["plan:app", "policy:app"]);
|
|
126
|
+
});
|
|
127
|
+
|
|
123
128
|
test("a failed plan job signs neither, and the note line says which were signed", () => {
|
|
124
129
|
const failed = planReportChecks(dir({ "pr-plan.json": { policy: { result: "passed" } } }), "failure");
|
|
125
130
|
expect(failed.sign).toEqual([]);
|
|
@@ -159,8 +159,19 @@ export function commitAndTree(repo: string, rev: string): { commit: string; tree
|
|
|
159
159
|
return { commit, tree: git(repo, ["rev-parse", `${commit}^{tree}`]) };
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
/**
|
|
163
|
-
export
|
|
162
|
+
/** Where a check's pass was read from (#4926): the forge's run and job ids, and the step whose conclusion said so. */
|
|
163
|
+
export interface CheckSource {
|
|
164
|
+
run: number;
|
|
165
|
+
job: number;
|
|
166
|
+
step?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The check's statement over `commit`, with the digest of what it said when
|
|
171
|
+
* given, and (#4926) the run, job and step a signer outside the check's job
|
|
172
|
+
* read its pass from, so a verifier can look them up.
|
|
173
|
+
*/
|
|
174
|
+
export function checkStatement(input: { commit: string; tree: string; check: string; runner: string; claim?: Buffer | string; source?: CheckSource }): EvidenceStatement {
|
|
164
175
|
if (!input.check.trim()) throw new Error("a check's evidence needs the check's name");
|
|
165
176
|
return {
|
|
166
177
|
_type: STATEMENT_TYPE,
|
|
@@ -172,6 +183,7 @@ export function checkStatement(input: { commit: string; tree: string; check: str
|
|
|
172
183
|
tree: input.tree,
|
|
173
184
|
check: input.check,
|
|
174
185
|
...(input.claim !== undefined ? { claim: { sha256: createHash("sha256").update(input.claim).digest("hex") } } : {}),
|
|
186
|
+
...(input.source ? { source: { run: input.source.run, job: input.source.job, ...(input.source.step ? { step: input.source.step } : {}) } } : {}),
|
|
175
187
|
},
|
|
176
188
|
};
|
|
177
189
|
}
|
|
@@ -186,11 +198,11 @@ export interface SignedCheck {
|
|
|
186
198
|
}
|
|
187
199
|
|
|
188
200
|
/** Sign each of `checks` over `at` with `signer`. Writes nothing. */
|
|
189
|
-
export async function signChecks(repo: string, at: string, checks: readonly { check: string; claim?: Buffer | string }[], signer: EvidenceSigner): Promise<SignedCheck[]> {
|
|
201
|
+
export async function signChecks(repo: string, at: string, checks: readonly { check: string; claim?: Buffer | string; source?: CheckSource }[], signer: EvidenceSigner): Promise<SignedCheck[]> {
|
|
190
202
|
const { commit, tree } = commitAndTree(repo, at);
|
|
191
203
|
const out: SignedCheck[] = [];
|
|
192
|
-
for (const { check, claim } of checks) {
|
|
193
|
-
const statement = checkStatement({ commit, tree, check, runner: signer.principal, ...(claim !== undefined ? { claim } : {}) });
|
|
204
|
+
for (const { check, claim, source } of checks) {
|
|
205
|
+
const statement = checkStatement({ commit, tree, check, runner: signer.principal, ...(claim !== undefined ? { claim } : {}), ...(source ? { source } : {}) });
|
|
194
206
|
out.push({ check, commit, tree, runner: signer.principal, envelope: await signer.sign(IN_TOTO_PAYLOAD_TYPE, Buffer.from(canonicalJson(statement), "utf8")) });
|
|
195
207
|
}
|
|
196
208
|
return out;
|
|
@@ -81,6 +81,11 @@ export const evidenceStatementSchema = z
|
|
|
81
81
|
check: z.string().min(1),
|
|
82
82
|
claim: z.object({ sha256: sha256Hex }).strict().optional(),
|
|
83
83
|
environment: z.object({ sha256: sha256Hex }).strict().optional(),
|
|
84
|
+
// #4926: the forge's record the signer relied on: the run, the job, and the step whose conclusion it read.
|
|
85
|
+
source: z
|
|
86
|
+
.object({ run: z.number().int().nonnegative(), job: z.number().int().nonnegative(), step: z.string().min(1).optional() })
|
|
87
|
+
.strict()
|
|
88
|
+
.optional(),
|
|
84
89
|
})
|
|
85
90
|
.strict(),
|
|
86
91
|
})
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant ci evidence sign --open` (#4914): the GitLab signing job, in a
|
|
3
|
+
* pipeline of the target branch, signs the checks of every open merge
|
|
4
|
+
* request into the branch from its newest pipeline's job.
|
|
5
|
+
*
|
|
6
|
+
* A merge request pipeline is built from the merge request's own files, so
|
|
7
|
+
* a job there that holds the runner key (or asks for a signing token) runs
|
|
8
|
+
* whatever the change wrote. The plan notes pipeline (#4328) is the target
|
|
9
|
+
* branch's: its jobs come from the branch's files, and its protected
|
|
10
|
+
* variables reach it. So the signing moves there, as the note posting did:
|
|
11
|
+
* for each open merge request GitLab names the newest pipeline's `job`
|
|
12
|
+
* (`plan`, `<target>-plan`, `check`), the report is read from that job's
|
|
13
|
+
* artifacts as data, the head is fetched, and the checks are signed for
|
|
14
|
+
* the head as `sign --from-report` signs them. What was signed and why the
|
|
15
|
+
* rest were not is kept as `<out>/<iid>/evidence.json`, with the merge
|
|
16
|
+
* request and the head, which the note job reads (`pr-post --open
|
|
17
|
+
* --evidence-dir`, ../../pr-post.ts) for the note's "Checks:" line.
|
|
18
|
+
*
|
|
19
|
+
* A job that has not settled is left for the next pipeline. A merge request
|
|
20
|
+
* whose report does not read, whose head does not fetch, or that the forge
|
|
21
|
+
* refuses is a warning, and the others go on.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
import type { PrForge } from "../../pr-forge";
|
|
27
|
+
import { CHECK_EVIDENCE_FILE, type CheckEvidenceNote, type OpenEvidenceFile } from "./check-evidence-report";
|
|
28
|
+
|
|
29
|
+
/** The report files a job's artifact is read for, in order: a plan report, a product's plan note hand-off, then a check job's report. */
|
|
30
|
+
export const OPEN_PLAN_FILES = ["pr-plan.json", "pr-plan-note.json"] as const;
|
|
31
|
+
export const OPEN_CHECK_FILE = "check-hooks.json";
|
|
32
|
+
|
|
33
|
+
/** What {@link signOpenReports} signs for. */
|
|
34
|
+
export interface OpenEvidenceInput {
|
|
35
|
+
/**
|
|
36
|
+
* A GitLab client with {@link PrForge.mergeRequestJobs} and
|
|
37
|
+
* {@link PrForge.jobArtifact}, and with `noForks` {@link PrForge.openPullRequests},
|
|
38
|
+
* which says which merge requests come from a fork. The fork test is read
|
|
39
|
+
* here, not in `mergeRequestJobs`, to keep it out of the pull request loop's
|
|
40
|
+
* bundle (its ceiling, pr-loop-bundle.test.ts).
|
|
41
|
+
*/
|
|
42
|
+
forge: Pick<PrForge, "kind" | "mergeRequestJobs" | "jobArtifact" | "openPullRequests">;
|
|
43
|
+
/** The branch the merge requests merge into: the pipeline's own. */
|
|
44
|
+
branch: string;
|
|
45
|
+
/** The job whose report is signed: `plan`, `<target>-plan` or `check`. */
|
|
46
|
+
job: string;
|
|
47
|
+
/** The report directory from the repository root, as the job kept it as its artifact. */
|
|
48
|
+
artifactDir: string;
|
|
49
|
+
/** Where each merge request's report and `evidence.json` go: `<out>/<iid>/`. */
|
|
50
|
+
out: string;
|
|
51
|
+
/** Sign for no merge request from a fork, as a product plan with `forks: "skip"` plans none. */
|
|
52
|
+
noForks?: boolean;
|
|
53
|
+
/** Fetch merge request `pr`'s head into this checkout; true once the commit is here. */
|
|
54
|
+
fetchHead: (pr: number, head: string) => boolean;
|
|
55
|
+
/** Sign the checks of the report in `dir` for `head`, given the job's result, as `sign --from-report` does. */
|
|
56
|
+
sign: (dir: string, head: string, result: "success" | "failure" | "cancelled") => Promise<CheckEvidenceNote>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** What {@link signOpenReports} did for one merge request. */
|
|
60
|
+
export interface OpenEvidence {
|
|
61
|
+
pr: number;
|
|
62
|
+
head: string;
|
|
63
|
+
/** What was signed and what was not, as kept in `evidence.json`. */
|
|
64
|
+
note?: CheckEvidenceNote;
|
|
65
|
+
/** Why nothing was signed: the job has not settled, left no report, or its head did not fetch. */
|
|
66
|
+
skipped?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Sign every open merge request's settled `job` into `branch` (#4914). */
|
|
70
|
+
export async function signOpenReports(input: OpenEvidenceInput): Promise<{ done: OpenEvidence[]; warnings: string[] }> {
|
|
71
|
+
const { forge } = input;
|
|
72
|
+
if (!forge.mergeRequestJobs || !forge.jobArtifact) {
|
|
73
|
+
throw new Error(`ci evidence sign --open reads the jobs of open merge requests, which ${forge.kind} cannot say; it is for GitLab`);
|
|
74
|
+
}
|
|
75
|
+
const done: OpenEvidence[] = [];
|
|
76
|
+
const warnings: string[] = [];
|
|
77
|
+
const at = input.artifactDir.replace(/\/+$/, "");
|
|
78
|
+
let forks = new Set<number>();
|
|
79
|
+
if (input.noForks) {
|
|
80
|
+
if (!forge.openPullRequests) throw new Error(`ci evidence sign --open --no-forks reads which merge requests come from a fork, which ${forge.kind} cannot say`);
|
|
81
|
+
forks = new Set((await forge.openPullRequests(input.branch)).filter((p) => p.fork).map((p) => p.number));
|
|
82
|
+
}
|
|
83
|
+
for (const job of await forge.mergeRequestJobs(input.branch, input.job)) {
|
|
84
|
+
if (forks.has(job.pr)) {
|
|
85
|
+
done.push({ pr: job.pr, head: job.head, skipped: "the merge request is from a fork" });
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const result = job.status === "success" ? "success" : job.status === "failed" ? "failure" : job.status === "canceled" ? "cancelled" : undefined;
|
|
89
|
+
if (!result) {
|
|
90
|
+
done.push({ pr: job.pr, head: job.head, skipped: `the ${input.job} job is ${job.status}` });
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const dir = join(input.out, String(job.pr));
|
|
95
|
+
mkdirSync(dir, { recursive: true });
|
|
96
|
+
// A plan report wins over a check report, as `sign --from-report` reads a directory.
|
|
97
|
+
let found = false;
|
|
98
|
+
for (const file of OPEN_PLAN_FILES) {
|
|
99
|
+
const text = await forge.jobArtifact(job.id, `${at}/${file}`);
|
|
100
|
+
if (text === undefined) continue;
|
|
101
|
+
writeFileSync(join(dir, file), text);
|
|
102
|
+
found = true;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (!found) {
|
|
106
|
+
const text = await forge.jobArtifact(job.id, `${at}/${OPEN_CHECK_FILE}`);
|
|
107
|
+
if (text !== undefined) {
|
|
108
|
+
writeFileSync(join(dir, OPEN_CHECK_FILE), text);
|
|
109
|
+
found = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!found) {
|
|
113
|
+
done.push({ pr: job.pr, head: job.head, skipped: `the ${input.job} job left no report under ${at}` });
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (!input.fetchHead(job.pr, job.head)) {
|
|
117
|
+
done.push({ pr: job.pr, head: job.head, skipped: `the head ${job.head.slice(0, 12)} did not fetch` });
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const note = await input.sign(dir, job.head, result);
|
|
121
|
+
const kept: OpenEvidenceFile = { pr: job.pr, head: job.head, ...note };
|
|
122
|
+
writeFileSync(join(dir, CHECK_EVIDENCE_FILE), JSON.stringify(kept, null, 2) + "\n");
|
|
123
|
+
done.push({ pr: job.pr, head: job.head, note });
|
|
124
|
+
} catch (err) {
|
|
125
|
+
warnings.push(`!${job.pr}: ${err instanceof Error ? err.message : String(err)}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { done, warnings };
|
|
129
|
+
}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
describeDecision,
|
|
28
28
|
readRefGateLedger,
|
|
29
29
|
refGateLedgerPath,
|
|
30
|
+
REF_GATE_STATUS,
|
|
30
31
|
RefUpdateInputError,
|
|
31
32
|
runPrePush,
|
|
32
33
|
runPreReceive,
|
|
@@ -48,6 +49,7 @@ const OVERRIDE_REQUEST_HOURS = 72;
|
|
|
48
49
|
const USAGE =
|
|
49
50
|
"chant workspace ref-gate check --ref <ref> [--at <rev>] [--base <rev>] [--dry-run] [--ledger <file>] [--json]\n" +
|
|
50
51
|
" chant workspace ref-gate status --ref <ref> [--at <rev>] [--base <rev>] [--dry-run] [--ledger <file>] [--json]\n" +
|
|
52
|
+
" chant workspace ref-gate status --open --ref refs/heads/<branch> [--base <rev>] [--dry-run] [--ledger <file>] [--json]\n" +
|
|
51
53
|
" chant workspace ref-gate pre-receive|pre-push [--ledger <file>] [--dry-run] [--json] (git hook input on stdin)\n" +
|
|
52
54
|
" chant workspace ref-gate attach --envelope <file> [--at <rev>]\n" +
|
|
53
55
|
" chant workspace ref-gate install --hook pre-receive|pre-push [--git-dir <dir>] [--chant <command>]";
|
|
@@ -82,7 +84,7 @@ function repoHere(): { repo: string; bare: boolean } | null {
|
|
|
82
84
|
return { repo: top, bare: false };
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
function print(json: boolean | undefined, decisions: RefDecision[], ledger: string | undefined, stream: "out" | "err"): void {
|
|
87
|
+
function print(json: boolean | undefined, decisions: RefDecision[], ledger: string | undefined, stream: "out" | "err", site?: RefGateSite): void {
|
|
86
88
|
const ok = decisions.every((d) => d.decision === "admit");
|
|
87
89
|
if (json) {
|
|
88
90
|
console.log(JSON.stringify({ ...head(), ok, ...(ledger ? { ledger } : {}), decisions }, null, 2));
|
|
@@ -90,7 +92,7 @@ function print(json: boolean | undefined, decisions: RefDecision[], ledger: stri
|
|
|
90
92
|
}
|
|
91
93
|
for (const d of decisions) {
|
|
92
94
|
if (d.status === null && d.checks.length === 0 && !d.error) continue;
|
|
93
|
-
const text = describeDecision(d).join("\n");
|
|
95
|
+
const text = describeDecision(d, site ? { site } : {}).join("\n");
|
|
94
96
|
if (stream === "err" || d.decision === "refuse") console.error(text);
|
|
95
97
|
else console.log(text);
|
|
96
98
|
}
|
|
@@ -161,7 +163,7 @@ export async function runWorkspaceRefGate(ctx: CommandContext): Promise<number>
|
|
|
161
163
|
try {
|
|
162
164
|
if (sub === "pre-receive") {
|
|
163
165
|
const r = runPreReceive(here.repo, stdin, { ...(args.ledger ? { ledger: args.ledger } : {}), now });
|
|
164
|
-
print(args.json, r.decisions, r.ledger, "err");
|
|
166
|
+
print(args.json, r.decisions, r.ledger, "err", "pre-receive");
|
|
165
167
|
return r.ok ? 0 : 1;
|
|
166
168
|
}
|
|
167
169
|
const r = runPrePush(here.repo, stdin, { ...(args.ledger ? { ledger: args.ledger } : {}), now, base: (repo) => resolveBase(repo).commit });
|
|
@@ -176,6 +178,10 @@ export async function runWorkspaceRefGate(ctx: CommandContext): Promise<number>
|
|
|
176
178
|
|
|
177
179
|
// check and status: one update, from a checkout or a CI job.
|
|
178
180
|
if (!args.ref || !args.ref.startsWith("refs/")) return usage("--ref <ref> is required, as a full ref name such as refs/heads/main");
|
|
181
|
+
if (args.open) {
|
|
182
|
+
if (sub !== "status") return usage("--open sets the status of every open pull request, so it goes with status");
|
|
183
|
+
return statusOpen(here.repo, args.ref, args.base, args.ledger, args.dryRun === true, args.json, now);
|
|
184
|
+
}
|
|
179
185
|
const at = commitOf(here.repo, args.at ?? "HEAD");
|
|
180
186
|
if (!at) return fail(args.json, "revision-unknown", `--at ${args.at ?? "HEAD"} names no commit`);
|
|
181
187
|
const resolved = resolveBase(here.repo, args.base);
|
|
@@ -187,25 +193,97 @@ export async function runWorkspaceRefGate(ctx: CommandContext): Promise<number>
|
|
|
187
193
|
if (!args.dryRun) appendRefGateLedger(ledger, [{ ...d, version: 1, kind: "ref-update", site, timestamp: now }]);
|
|
188
194
|
print(args.json, [d], args.dryRun ? undefined : ledger, "out");
|
|
189
195
|
if (site === "check" && d.decision === "refuse" && !args.dryRun && !here.bare) await recordRequests(here.repo, [d], now);
|
|
190
|
-
|
|
196
|
+
const context = refGateStatusContext(d);
|
|
197
|
+
if (site === "status" && context !== null) {
|
|
191
198
|
if (args.dryRun) {
|
|
192
|
-
console.error(`chant ref gate: would set ${
|
|
199
|
+
console.error(`chant ref gate: would set ${context} to ${d.decision === "admit" ? "success" : "failure"} on ${at.slice(0, 8)}`);
|
|
193
200
|
} else {
|
|
194
|
-
const { detectForge
|
|
201
|
+
const { detectForge } = await import("../../pr-forge");
|
|
195
202
|
const kind = detectForge();
|
|
196
203
|
if (!kind) {
|
|
197
|
-
console.error(formatError({ message: `no forge detected, so ${
|
|
204
|
+
console.error(formatError({ message: `no forge detected, so ${context} was not set`, hint: "run it in a GitHub, GitLab or Forgejo job, or pass --dry-run" }));
|
|
198
205
|
return 1;
|
|
199
206
|
}
|
|
200
|
-
|
|
207
|
+
// #4964: `--at` is a pull_request run's merge preview; the status goes on the pull request's head.
|
|
208
|
+
const { forgeFromJobEnv } = await import("../../pr-forge-job");
|
|
209
|
+
await postRefGateStatus(forgeFromJobEnv(kind), d);
|
|
201
210
|
}
|
|
202
211
|
}
|
|
203
212
|
return d.decision === "admit" ? 0 : 1;
|
|
204
213
|
}
|
|
205
214
|
|
|
206
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* `status --open --ref refs/heads/<branch>` (#4935): the status of every open
|
|
217
|
+
* pull request into the branch, from a pipeline of the branch. GitLab sets a
|
|
218
|
+
* commit status only with the protected token a target-branch pipeline holds
|
|
219
|
+
* (#4328), so its generated `ref-gate` job runs here, beside the plan notes.
|
|
220
|
+
* Each head is fetched and decided as `status --at <head>` decides it, against
|
|
221
|
+
* the policy at `base` (default this checkout's `HEAD`, the branch's commit).
|
|
222
|
+
* A head that does not fetch, or a forge that refuses one status, is said
|
|
223
|
+
* and the others go on. Exits 0 once each is set, whatever it decided: each
|
|
224
|
+
* pull request's status says it.
|
|
225
|
+
*/
|
|
226
|
+
async function statusOpen(repo: string, ref: string, baseRev: string | undefined, ledgerFlag: string | undefined, dryRun: boolean, json: boolean | undefined, now: string): Promise<number> {
|
|
227
|
+
if (!ref.startsWith("refs/heads/")) return usage("--open names the branch the pull requests merge into: --ref refs/heads/<branch>");
|
|
228
|
+
const base = commitOf(repo, baseRev ?? "HEAD");
|
|
229
|
+
if (!base) return fail(json, "revision-unknown", `--base ${baseRev ?? "HEAD"} names no commit`);
|
|
230
|
+
const { detectForge, forgeFromEnv } = await import("../../pr-forge");
|
|
231
|
+
const kind = detectForge();
|
|
232
|
+
if (!kind && !dryRun) {
|
|
233
|
+
console.error(formatError({ message: "no forge detected, so no status was set", hint: "run it in a GitHub, GitLab or Forgejo job, or pass --dry-run" }));
|
|
234
|
+
return 1;
|
|
235
|
+
}
|
|
236
|
+
const forge = kind ? forgeFromEnv(kind) : undefined;
|
|
237
|
+
if (!forge?.openPullRequests) return fail(json, "ref-update-invalid", `--open lists the open pull requests, which ${kind ?? "no"} forge client here can`);
|
|
238
|
+
const branch = ref.slice("refs/heads/".length);
|
|
239
|
+
const ledger = ledgerFlag ?? refGateLedgerPath(repo);
|
|
240
|
+
const decisions: RefDecision[] = [];
|
|
241
|
+
for (const pr of await forge.openPullRequests(branch)) {
|
|
242
|
+
const fetched = spawnSync("git", ["fetch", "--quiet", "--no-tags", "origin", pr.headSha], { cwd: repo, encoding: "utf-8" });
|
|
243
|
+
if (!commitOf(repo, pr.headSha)) {
|
|
244
|
+
console.error(`chant ref gate: #${pr.number}'s head ${pr.headSha.slice(0, 8)} did not fetch${fetched.stderr ? ` (${fetched.stderr.trim().split("\n")[0]})` : ""}, so its status is left as it is`);
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const spent = spentOverrides(readRefGateLedger(ledger));
|
|
248
|
+
const d = decideRefUpdate({ repo, update: { ref, old: base, new: pr.headSha }, base, spent, now });
|
|
249
|
+
decisions.push(d);
|
|
250
|
+
if (dryRun) {
|
|
251
|
+
const context = refGateStatusContext(d);
|
|
252
|
+
if (context !== null) console.error(`chant ref gate: would set ${context} to ${d.decision === "admit" ? "success" : "failure"} on #${pr.number} at ${pr.headSha.slice(0, 8)}`);
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
appendRefGateLedger(ledger, [{ ...d, version: 1, kind: "ref-update", site: "status", timestamp: now }]);
|
|
256
|
+
try {
|
|
257
|
+
await postRefGateStatus(forge, d);
|
|
258
|
+
} catch (err) {
|
|
259
|
+
console.error(`chant ref gate: could not set the status on #${pr.number}: ${err instanceof Error ? err.message : String(err)}`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
print(json, decisions, dryRun ? undefined : ledger, "err");
|
|
263
|
+
if (decisions.length === 0) console.error(`chant ref gate: no open pull request into ${branch} to set a status on`);
|
|
264
|
+
return 0;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** The status `d` sets: its rule's, or `chant/ref-gate` when the gate could not decide (#4964); null when no rule matched. */
|
|
268
|
+
export function refGateStatusContext(d: Pick<RefDecision, "status" | "error">): string | null {
|
|
269
|
+
return d.status ?? (d.error ? REF_GATE_STATUS : null);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The commit status a forge requires for `d`'s ref: `success` when it is
|
|
274
|
+
* admitted, `failure` naming the missing checks when not. A gate that could
|
|
275
|
+
* not decide (#4964: the policy at base does not read, or the commit is not
|
|
276
|
+
* there) fails `chant/ref-gate` closed: the policy that would name another
|
|
277
|
+
* status is the one that did not read, and a forge that requires the status
|
|
278
|
+
* then refuses the merge rather than waiting for a status that never comes.
|
|
279
|
+
*/
|
|
207
280
|
export async function postRefGateStatus(forge: { setStatus(sha: string, status: { context: string; state: "success" | "failure"; description: string }): Promise<void> }, d: RefDecision): Promise<void> {
|
|
208
|
-
|
|
281
|
+
const context = refGateStatusContext(d);
|
|
282
|
+
if (context === null || d.new === null) return;
|
|
283
|
+
if (d.status === null) {
|
|
284
|
+
await forge.setStatus(d.new, { context, state: "failure", description: `refused: ${d.error!.code}` });
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
209
287
|
const missing = d.checks.filter((c) => c.action === "block" && (c.status === "missing" || c.status === "stale"));
|
|
210
288
|
const overridden = d.checks.filter((c) => c.status === "overridden").map((c) => c.check);
|
|
211
289
|
const description = d.error
|