@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
package/src/ci-image.ts
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
* product records others in its own config and passes them as `sha256`.
|
|
17
17
|
* - {@link ciToolFetchScript} is the shell that downloads one release and
|
|
18
18
|
* checks it, for an image's fetch stage; {@link ciToolInstallLine} is the
|
|
19
|
-
* job line that runs it unless the binary is there
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* job line that runs it unless the binary is there (with `sudo`, or under
|
|
20
|
+
* a root such as `$RUNNER_TEMP/chant-tools`, for a job that is not root,
|
|
21
|
+
* #4908). With `download: "node"` both fetch and unpack with node, for
|
|
22
|
+
* an image with no curl or unzip (#4952). {@link installCiTool} does the same from Node, for a product
|
|
23
|
+
* that installs a pinned release at run time.
|
|
22
24
|
* - {@link productImageStages} is a product's image as stages a Dockerfile
|
|
23
25
|
* takes (the docker lexicon's `new Dockerfile({ stages })`), and
|
|
24
26
|
* {@link productImageDockerfile} is the same as text. The product passes
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
* project publishes a checksums file is checked against that file's line
|
|
31
33
|
* for the archive, and against the recorded sha256 when there is one, so a
|
|
32
34
|
* tampered checksums file fails as a tampered archive does. A release with
|
|
33
|
-
* no checksums file (the AWS CLI, just
|
|
35
|
+
* no checksums file (the AWS CLI, just before 1.35.0) needs a recorded sha256. An
|
|
34
36
|
* image always needs a recorded sha256 for both architectures, and a caller
|
|
35
37
|
* passes `requirePin` to ask the same of a job line or a run-time install.
|
|
36
38
|
*
|
|
@@ -46,9 +48,9 @@ import { tmpdir } from "node:os";
|
|
|
46
48
|
import { join } from "node:path";
|
|
47
49
|
import { gunzipSync, inflateRawSync } from "node:zlib";
|
|
48
50
|
import { tarEntry } from "./policy-engine";
|
|
49
|
-
import { CI_IMAGE_FLOOR } from "./release-floors";
|
|
51
|
+
import { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR } from "./release-floors";
|
|
50
52
|
|
|
51
|
-
export { CI_IMAGE_FLOOR };
|
|
53
|
+
export { CI_IMAGE_DOCKER_STAGES_FLOOR, CI_IMAGE_FLOOR, CI_IMAGE_NON_ROOT_FLOOR, CI_TOOL_NODE_DOWNLOAD_FLOOR };
|
|
52
54
|
|
|
53
55
|
// ---------------------------------------------------------------------------
|
|
54
56
|
// Engine releases
|
|
@@ -87,8 +89,8 @@ interface ToolSpec {
|
|
|
87
89
|
words: Record<CiToolArch, string>;
|
|
88
90
|
base(version: string): string;
|
|
89
91
|
asset(version: string, word: string): string;
|
|
90
|
-
/** The checksums file, beside the asset under `base`; absent when the release publishes none. */
|
|
91
|
-
checksums?(version: string, asset: string): string;
|
|
92
|
+
/** The checksums file, beside the asset under `base`; absent, or undefined for a version, when the release publishes none. */
|
|
93
|
+
checksums?(version: string, asset: string): string | undefined;
|
|
92
94
|
layout: CiToolLayout;
|
|
93
95
|
/** The binary inside the archive, for `tar.gz` and `zip`. Default `bin`. */
|
|
94
96
|
member?(word: string): string;
|
|
@@ -96,6 +98,12 @@ interface ToolSpec {
|
|
|
96
98
|
path?: string;
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
/** Whether a release version is at least `major.minor`. */
|
|
102
|
+
function atLeast(version: string, major: number, minor: number): boolean {
|
|
103
|
+
const [a = 0, b = 0] = version.split(".").map((n) => Number.parseInt(n, 10));
|
|
104
|
+
return a > major || (a === major && b >= minor);
|
|
105
|
+
}
|
|
106
|
+
|
|
99
107
|
const STD = { amd64: "amd64", arm64: "arm64" };
|
|
100
108
|
const GNU = { amd64: "x86_64", arm64: "aarch64" };
|
|
101
109
|
const NODE_WORDS = { amd64: "x64", arm64: "arm64" };
|
|
@@ -196,6 +204,8 @@ const TOOLS: Record<CiTool, ToolSpec> = {
|
|
|
196
204
|
words: GNU,
|
|
197
205
|
base: (v) => `https://github.com/casey/just/releases/download/${v}`,
|
|
198
206
|
asset: (v, w) => `just-${v}-${w}-unknown-linux-musl.tar.gz`,
|
|
207
|
+
// #4952: just publishes `SHA256SUMS` from 1.37.0, one `<file>.sha256sum` per file in 1.35.0 and 1.36.0, and none before.
|
|
208
|
+
checksums: (v, asset) => (atLeast(v, 1, 37) ? "SHA256SUMS" : atLeast(v, 1, 35) ? `${asset}.sha256sum` : undefined),
|
|
199
209
|
layout: "tar.gz",
|
|
200
210
|
},
|
|
201
211
|
act: {
|
|
@@ -203,6 +213,7 @@ const TOOLS: Record<CiTool, ToolSpec> = {
|
|
|
203
213
|
words: { amd64: "x86_64", arm64: "arm64" },
|
|
204
214
|
base: (v) => `https://github.com/nektos/act/releases/download/v${v}`,
|
|
205
215
|
asset: (_v, w) => `act_Linux_${w}.tar.gz`,
|
|
216
|
+
checksums: () => "checksums.txt",
|
|
206
217
|
layout: "tar.gz",
|
|
207
218
|
},
|
|
208
219
|
};
|
|
@@ -230,6 +241,22 @@ export const CI_TOOL_SHA256: Readonly<Record<string, string>> = {
|
|
|
230
241
|
"plunge-0.2.0-linux-arm64": "c176a82f038164085aa19c8ad6530d6022e560e124050e535dbe364ae0473357",
|
|
231
242
|
"aws-cli-2.22.0-linux-amd64": "f315aa564190a12ae05a05bd8ab7b0645dd4a1ad71ce9e47dae4ff3dfeee8ceb",
|
|
232
243
|
"aws-cli-2.22.0-linux-arm64": "c932ac00901ea3c430f3829140b8dc00fa6e9b8b99d6891929a4795947de7f3e",
|
|
244
|
+
// #4908: terragucci's image pins (its TOOL_SHA256, from terraform_1.14.9_SHA256SUMS and terragrunt v1.2.0's SHA256SUMS)
|
|
245
|
+
// and the AWS CLI its drift job installs (its AWS_CLI), so a product's image and job lines need no sums of their own.
|
|
246
|
+
"terraform-1.14.9-linux-amd64": "2e5cffc20a0b48a67a76268723bd5a10b8666f69b2aa4f04906e206726bedd63",
|
|
247
|
+
"terraform-1.14.9-linux-arm64": "863002085b886453795d9ff4b8989b8468784478150b70ba8a1df3e3ad66da99",
|
|
248
|
+
"terragrunt-1.2.0-linux-amd64": "45b6df8a8494c8cfe34b4abf919e894709557163e4d3b5704d11083002ab787a",
|
|
249
|
+
"terragrunt-1.2.0-linux-arm64": "b069ce4310572bc46ee6f057057acc4bc6a9077ef8687e157a64b0551290a371",
|
|
250
|
+
"aws-cli-2.37.9-linux-amd64": "6b3a6a3d7bb3997928f0bdf7b866914224abf242c2e54e1dcebbe84bee64f356",
|
|
251
|
+
"aws-cli-2.37.9-linux-arm64": "e7d2cca3622af4765871fe9ce7eeed03acd09dca10a99ebc46e92f79d78765c0",
|
|
252
|
+
// #4952: terragucci's just and act pins (its workflows/shared.ts), read on 2026-11-10 from
|
|
253
|
+
// https://github.com/casey/just/releases/download/1.36.0/just-1.36.0-{x86_64,aarch64}-unknown-linux-musl.tar.gz.sha256sum
|
|
254
|
+
// and https://github.com/nektos/act/releases/download/v0.2.89/checksums.txt.
|
|
255
|
+
// squawk is not here: its releases publish no checksums file, only bare binaries, and no product pins a release.
|
|
256
|
+
"just-1.36.0-linux-amd64": "bc7c9f377944f8de9cd0418b11d2955adebfa25a488c0b5e3dd2d2c0e9d732da",
|
|
257
|
+
"just-1.36.0-linux-arm64": "bb3886b15e2cbcb9c0eb19956297d36de4eaef45b89d3f5fa5d1fc4ed3b5b51d",
|
|
258
|
+
"act-0.2.89-linux-amd64": "0191d6f1f3b716b5c55820032605d05fc3c1cdbf581ebeff655019e5dd1524c0",
|
|
259
|
+
"act-0.2.89-linux-arm64": "daa8679ba9615a74d2d0cec321dc593f21948a2a11bb65862b063d8b930f4bcb",
|
|
233
260
|
};
|
|
234
261
|
|
|
235
262
|
/** One release file of one tool for one architecture. */
|
|
@@ -256,6 +283,13 @@ export interface CiToolRelease {
|
|
|
256
283
|
const VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?$/;
|
|
257
284
|
const SHA256 = /^[0-9a-f]{64}$/;
|
|
258
285
|
const DIR = /^\/[A-Za-z0-9._/-]*$/;
|
|
286
|
+
/**
|
|
287
|
+
* A directory a job line may name (#4908): an absolute path, or one under a
|
|
288
|
+
* variable the job's shell expands, such as `$RUNNER_TEMP/chant-tools` or
|
|
289
|
+
* `$HOME/.local/bin`, so a job that is not root installs where it can write.
|
|
290
|
+
* Every line writes it inside double quotes.
|
|
291
|
+
*/
|
|
292
|
+
const SHELL_DIR = /^(?:\/|\$[A-Za-z_][A-Za-z0-9_]*(?=\/|$)|\$\{[A-Za-z_][A-Za-z0-9_]*\})[A-Za-z0-9._/-]*$/;
|
|
259
293
|
|
|
260
294
|
function spec(tool: CiTool): ToolSpec {
|
|
261
295
|
const s = TOOLS[tool];
|
|
@@ -304,10 +338,10 @@ export function ciToolSha256(tool: CiTool, version: string, given?: Partial<Reco
|
|
|
304
338
|
return out;
|
|
305
339
|
}
|
|
306
340
|
|
|
307
|
-
/** Where a tool lives once installed: `<root>/<tool>-<version>`. */
|
|
341
|
+
/** Where a tool lives once installed: `<root>/<tool>-<version>`. A job line's root may start with a shell variable (#4908). */
|
|
308
342
|
export function ciToolDir(tool: CiTool, version: string, root: string): string {
|
|
309
343
|
checkVersion(tool, version);
|
|
310
|
-
if (!
|
|
344
|
+
if (!SHELL_DIR.test(root)) throw new Error(`a tool root is an absolute path of letters, digits and ._/-, or one under a variable such as $RUNNER_TEMP, not ${JSON.stringify(root)}`);
|
|
311
345
|
return `${root.replace(/\/+$/, "")}/${tool}-${version}`;
|
|
312
346
|
}
|
|
313
347
|
|
|
@@ -333,6 +367,48 @@ export interface CiToolCheckOptions {
|
|
|
333
367
|
requirePin?: boolean;
|
|
334
368
|
}
|
|
335
369
|
|
|
370
|
+
/**
|
|
371
|
+
* How a fetch line downloads and unpacks a release (#4952): `curl` (the
|
|
372
|
+
* default) with `unzip` for a zip, or `node`, which downloads with node's
|
|
373
|
+
* `fetch` and unpacks a zip with node, for a job whose image carries node
|
|
374
|
+
* but neither curl nor unzip. The check is the same either way; tar,
|
|
375
|
+
* sha256sum and sed are still the image's.
|
|
376
|
+
*/
|
|
377
|
+
export type CiToolDownload = "curl" | "node";
|
|
378
|
+
|
|
379
|
+
/** The download line's script for `download: "node"`: `node -e <it> <url> <file>`. A failed answer exits 1 naming the URL and the status. */
|
|
380
|
+
const NODE_FETCH_JS =
|
|
381
|
+
'const [u,o]=process.argv.slice(1);fetch(u).then(async(r)=>{if(!r.ok)throw new Error(u+": HTTP "+r.status);require("fs").writeFileSync(o,Buffer.from(await r.arrayBuffer()))}).catch((e)=>{console.error(e.message);process.exit(1)})';
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The unpack line's script for `download: "node"`: `node -e <it> <zip>
|
|
385
|
+
* <dir> [member]`, every entry (or the one member) written under `dir`
|
|
386
|
+
* with its executable bit and symbolic links kept, as the AWS CLI's
|
|
387
|
+
* installer needs. Stored and deflated entries only, as {@link unzipEntry}
|
|
388
|
+
* reads them; an entry whose path leaves `dir` fails the line. Written with
|
|
389
|
+
* no single quote or `$`, so it goes inside the shell's single quotes as it is.
|
|
390
|
+
*/
|
|
391
|
+
const NODE_UNZIP_JS = [
|
|
392
|
+
'const fs=require("fs"),p=require("path"),z=require("zlib");const [f,d,m]=process.argv.slice(1);const b=fs.readFileSync(f);',
|
|
393
|
+
'let e=b.length-22;while(e>=0&&b.readUInt32LE(e)!==0x06054b50)e--;if(e<0)throw new Error(f+" is not a zip archive");',
|
|
394
|
+
"const top=p.resolve(d);let o=b.readUInt32LE(e+16),hit=false;",
|
|
395
|
+
"for(let i=b.readUInt16LE(e+10);i>0;i--){",
|
|
396
|
+
'const meth=b.readUInt16LE(o+10),size=b.readUInt32LE(o+20),nl=b.readUInt16LE(o+28),xl=b.readUInt16LE(o+30),cl=b.readUInt16LE(o+32),mode=b.readUInt32LE(o+38)>>>16,l=b.readUInt32LE(o+42),n=b.toString("utf8",o+46,o+46+nl);',
|
|
397
|
+
"o+=46+nl+xl+cl;if(m&&n!==m)continue;hit=true;",
|
|
398
|
+
'const t=p.resolve(top,n);if(t!==top&&!t.startsWith(top+p.sep))throw new Error(n+" is outside "+d);',
|
|
399
|
+
'if(n.endsWith("/")){fs.mkdirSync(t,{recursive:true});continue}',
|
|
400
|
+
"const s=l+30+b.readUInt16LE(l+26)+b.readUInt16LE(l+28),raw=b.subarray(s,s+size),data=meth===0?raw:meth===8?z.inflateRawSync(raw):null;",
|
|
401
|
+
'if(!data)throw new Error(n+" uses compression method "+meth);fs.mkdirSync(p.dirname(t),{recursive:true});',
|
|
402
|
+
"if((mode&0o170000)===0o120000)fs.symlinkSync(data.toString(),t);else fs.writeFileSync(t,data,{mode:mode&0o111?0o755:0o644})}",
|
|
403
|
+
'if(m&&!hit)throw new Error(m+" is not in "+f)',
|
|
404
|
+
].join("");
|
|
405
|
+
|
|
406
|
+
function checkDownload(download: unknown): CiToolDownload {
|
|
407
|
+
if (download === undefined || download === "curl") return "curl";
|
|
408
|
+
if (download === "node") return "node";
|
|
409
|
+
throw new Error(`download is curl or node, not ${JSON.stringify(download)}`);
|
|
410
|
+
}
|
|
411
|
+
|
|
336
412
|
export interface CiToolFetchOptions extends CiToolCheckOptions {
|
|
337
413
|
/** The directory the tool installs into, an absolute path: {@link ciToolDir} under the image's tool root. */
|
|
338
414
|
dir: string;
|
|
@@ -340,10 +416,18 @@ export interface CiToolFetchOptions extends CiToolCheckOptions {
|
|
|
340
416
|
arch?: string;
|
|
341
417
|
/** A shell word for the checksums file's URL, such as `"$CHECKSUMS_URL"`. Default the release's own. */
|
|
342
418
|
checksumsUrl?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Write into `dir` with `sudo` (#4908), for a job that runs as a user who
|
|
421
|
+
* cannot write the tool root, such as GitHub's hosted runners under
|
|
422
|
+
* /opt. The download and the check run as the job's user. Default false.
|
|
423
|
+
*/
|
|
424
|
+
sudo?: boolean;
|
|
425
|
+
/** Download with curl (the default) or with node, for an image with no curl or unzip (#4952). */
|
|
426
|
+
download?: CiToolDownload;
|
|
343
427
|
}
|
|
344
428
|
|
|
345
429
|
function needPins(tool: CiTool, version: string, sums: Partial<Record<CiToolArch, string>>, requirePin: boolean): void {
|
|
346
|
-
const hasSums = spec(tool).checksums !== undefined;
|
|
430
|
+
const hasSums = spec(tool).checksums?.(version, "") !== undefined;
|
|
347
431
|
const missing = CI_TOOL_ARCHES.filter((a) => !sums[a]);
|
|
348
432
|
if (missing.length && (requirePin || !hasSums)) {
|
|
349
433
|
const why = hasSums ? "" : `; ${tool}'s release publishes no checksums file, so chant needs one`;
|
|
@@ -358,10 +442,16 @@ function needPins(tool: CiTool, version: string, sums: Partial<Record<CiToolArch
|
|
|
358
442
|
* release needs a recorded sha256 it lacks.
|
|
359
443
|
*/
|
|
360
444
|
export function ciToolFetchScript(tool: CiTool, version: string, options: CiToolFetchOptions): string {
|
|
361
|
-
if (!
|
|
445
|
+
if (!SHELL_DIR.test(options.dir)) throw new Error(`a fetch directory is an absolute path of letters, digits and ._/-, or one under a variable such as $RUNNER_TEMP, not ${JSON.stringify(options.dir)}`);
|
|
446
|
+
const su = options.sudo ? "sudo " : "";
|
|
362
447
|
const s = spec(tool);
|
|
363
448
|
const sums = ciToolSha256(tool, version, options.sha256);
|
|
364
449
|
needPins(tool, version, sums, options.requirePin === true);
|
|
450
|
+
const node = checkDownload(options.download) === "node";
|
|
451
|
+
// #4952: `get <url word> <file>` and `unzipTo <zip> <dir> [member]`, with curl and unzip or with node.
|
|
452
|
+
const get = (url: string, out: string): string => (node ? `node -e '${NODE_FETCH_JS}' ${url} "${out}"` : `curl -fsSLo "${out}" ${url}`);
|
|
453
|
+
const unzipTo = (zipFile: string, into: string, member?: string): string =>
|
|
454
|
+
node ? `node -e '${NODE_UNZIP_JS}' "${zipFile}" "${into}"${member ? ` "${member}"` : ""}` : `unzip -q${member ? " -o" : ""} "${zipFile}"${member ? ` "${member}"` : ""} -d "${into}"`;
|
|
365
455
|
const name = `${tool} ${version}`;
|
|
366
456
|
const base = s.base(version);
|
|
367
457
|
const file = s.asset(version, "$w");
|
|
@@ -371,13 +461,13 @@ export function ciToolFetchScript(tool: CiTool, version: string, options: CiTool
|
|
|
371
461
|
`case "$a" in ${CI_TOOL_ARCHES.map((a) => `(${a}) w=${s.words[a]} ;;`).join(" ")} (*) echo "${name}: chant fetches it for ${CI_TOOL_ARCHES.join(" and ")}, not $a" >&2; exit 1 ;; esac`,
|
|
372
462
|
`f="${file}"`,
|
|
373
463
|
`t="$(mktemp -d)"`,
|
|
374
|
-
`
|
|
464
|
+
get(`"${base}/$f"`, "$t/$f"),
|
|
375
465
|
`case "$a" in ${CI_TOOL_ARCHES.filter((a) => sums[a]).map((a) => `(${a}) want=${sums[a]} ;;`).join(" ")} (*) want= ;; esac`,
|
|
376
466
|
];
|
|
377
467
|
const checksums = s.checksums?.(version, file);
|
|
378
468
|
if (checksums) {
|
|
379
469
|
lines.push(
|
|
380
|
-
|
|
470
|
+
get(options.checksumsUrl ?? `"${base}/${checksums}"`, "$t/sums"),
|
|
381
471
|
// The archive's line, with any ./ or * before the name taken off.
|
|
382
472
|
`line="$(sed -n "s#^\\([0-9a-f]\\{64\\}\\) *[*.]*/*$f\\$#\\1#p" "$t/sums")"`,
|
|
383
473
|
`{ [ -n "$line" ] || { echo "${name}: $f is not in ${checksums}" >&2; exit 1; }; }`,
|
|
@@ -387,35 +477,57 @@ export function ciToolFetchScript(tool: CiTool, version: string, options: CiTool
|
|
|
387
477
|
} else {
|
|
388
478
|
lines.push(`{ [ -n "$want" ] || { echo "${name}: no sha256 is recorded for $f" >&2; exit 1; }; }`);
|
|
389
479
|
}
|
|
390
|
-
lines.push(`echo "$want $t/$f" | sha256sum -c - >/dev/null`,
|
|
480
|
+
lines.push(`echo "$want $t/$f" | sha256sum -c - >/dev/null`, `${su}mkdir -p "${dir}"`);
|
|
391
481
|
const member = s.member?.("$w") ?? s.bin;
|
|
392
482
|
switch (s.layout) {
|
|
393
483
|
case "binary":
|
|
394
|
-
lines.push(
|
|
484
|
+
lines.push(`${su}install -m 0755 "$t/$f" "${dir}/${s.bin}"`);
|
|
395
485
|
break;
|
|
396
486
|
case "tar.gz":
|
|
397
|
-
lines.push(`tar -xzf "$t/$f" -C "$t" "${member}"`,
|
|
487
|
+
lines.push(`tar -xzf "$t/$f" -C "$t" "${member}"`, `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
|
|
398
488
|
break;
|
|
399
489
|
case "zip":
|
|
400
|
-
lines.push(
|
|
490
|
+
lines.push(unzipTo("$t/$f", "$t", member), `${su}install -m 0755 "$t/${member}" "${dir}/${s.bin}"`);
|
|
401
491
|
break;
|
|
402
492
|
case "tree":
|
|
403
|
-
lines.push(
|
|
493
|
+
lines.push(`${su}tar -xzf "$t/$f" -C "${dir}" --strip-components=1`);
|
|
404
494
|
break;
|
|
405
495
|
case "aws-cli":
|
|
406
|
-
lines.push(
|
|
496
|
+
lines.push(unzipTo("$t/$f", "$t"), `${su}"$t/aws/install" -i "${dir}" -b "${dir}/bin"`);
|
|
407
497
|
break;
|
|
408
498
|
}
|
|
409
499
|
return lines.join(" && ");
|
|
410
500
|
}
|
|
411
501
|
|
|
412
502
|
export interface CiToolInstallOptions extends CiToolCheckOptions {
|
|
413
|
-
/**
|
|
503
|
+
/**
|
|
504
|
+
* Where the versioned directories live. Default {@link CI_TOOL_ROOT}. It
|
|
505
|
+
* may start with a variable the job's shell expands (#4908), such as
|
|
506
|
+
* `$RUNNER_TEMP/chant-tools`, for a job that is not root.
|
|
507
|
+
*/
|
|
414
508
|
root?: string;
|
|
415
|
-
/** Link the binary into
|
|
509
|
+
/** Link the binary into `binDir` (default true). `false` leaves PATH alone, for a pin a step runs by its path. */
|
|
416
510
|
link?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* Where the link goes. Default /usr/local/bin. Like `root` it may start
|
|
513
|
+
* with a variable (#4908), such as `$HOME/.local/bin`; the job puts it on
|
|
514
|
+
* PATH.
|
|
515
|
+
*/
|
|
516
|
+
binDir?: string;
|
|
517
|
+
/**
|
|
518
|
+
* Install into `root` and link into `binDir` with `sudo` (#4908), for a
|
|
519
|
+
* job that runs as a user who cannot write them, as on GitHub's hosted
|
|
520
|
+
* runners. The download and the check run as the job's user. Default false.
|
|
521
|
+
*/
|
|
522
|
+
sudo?: boolean;
|
|
417
523
|
/** Skip the install when any `<bin>` is on PATH, whatever its version. Default false: only the versioned directory counts. */
|
|
418
524
|
onPath?: boolean;
|
|
525
|
+
/**
|
|
526
|
+
* Download with curl (the default) or with node (#4952), for a job whose
|
|
527
|
+
* image carries node but neither curl nor unzip, such as terragucci's
|
|
528
|
+
* images installing the AWS CLI for drift attribution.
|
|
529
|
+
*/
|
|
530
|
+
download?: CiToolDownload;
|
|
419
531
|
}
|
|
420
532
|
|
|
421
533
|
/** Where a job line installs each release by default. */
|
|
@@ -433,9 +545,15 @@ export function ciToolInstallLine(tool: CiTool, version: string, options: CiTool
|
|
|
433
545
|
const dir = ciToolDir(tool, version, root);
|
|
434
546
|
const bin = ciToolBin(tool, version, root);
|
|
435
547
|
const s = spec(tool);
|
|
436
|
-
const
|
|
548
|
+
const binDir = (options.binDir ?? "/usr/local/bin").replace(/(.)\/+$/, "$1");
|
|
549
|
+
if (!SHELL_DIR.test(binDir)) throw new Error(`binDir is an absolute path of letters, digits and ._/-, or one under a variable such as $HOME, not ${JSON.stringify(options.binDir)}`);
|
|
550
|
+
const su = options.sudo ? "sudo " : "";
|
|
551
|
+
const install = `(set -e; ${ciToolFetchScript(tool, version, { dir, sha256: options.sha256, requirePin: options.requirePin, sudo: options.sudo, download: options.download })})`;
|
|
437
552
|
const inDir = `[ -x "${bin}" ]`;
|
|
438
|
-
|
|
553
|
+
// A plain path is written as it always was; one under a variable is quoted, so the shell expands it as one word.
|
|
554
|
+
const target = DIR.test(binDir) ? `${binDir}/${s.bin}` : `"${binDir}/${s.bin}"`;
|
|
555
|
+
const link = `${su}${options.binDir !== undefined ? `mkdir -p "${binDir}" && ${su}` : ""}ln -sf "${bin}" ${target}`;
|
|
556
|
+
const line = options.link === false ? `${inDir} || ${install}` : `{ ${inDir} || ${install}; } && ${link}`;
|
|
439
557
|
return options.onPath ? `command -v ${s.bin} >/dev/null 2>&1 || { ${line}; }` : line;
|
|
440
558
|
}
|
|
441
559
|
|
|
@@ -582,7 +700,19 @@ export const CI_BASE_IMAGES = {
|
|
|
582
700
|
export const CI_IMAGE_LABEL_ARG = "CHANT_RELEASE_LABEL";
|
|
583
701
|
|
|
584
702
|
/** One Dockerfile instruction, as the docker lexicon's stage `steps` take it: `{ run: "..." }`. */
|
|
585
|
-
|
|
703
|
+
/** The Dockerfile instructions a {@link CiImageStep} names. */
|
|
704
|
+
export type CiImageInstruction = "arg" | "env" | "run" | "copy" | "label" | "cmd" | "user" | "workdir" | "expose" | "entrypoint";
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* One Dockerfile instruction, as the docker lexicon's stage `steps` take it:
|
|
708
|
+
* `{ run: "..." }`. One key each, the others `never`, the shape of the
|
|
709
|
+
* lexicon's `DockerfileStep`, so `new Dockerfile({ stages:
|
|
710
|
+
* productImageStages(spec) })` compiles under `exactOptionalPropertyTypes`
|
|
711
|
+
* (#4932).
|
|
712
|
+
*/
|
|
713
|
+
export type CiImageStep = {
|
|
714
|
+
[K in CiImageInstruction]: { readonly [P in K]: string } & { readonly [P in Exclude<CiImageInstruction, K>]?: never };
|
|
715
|
+
}[CiImageInstruction];
|
|
586
716
|
|
|
587
717
|
/** One stage, as the docker lexicon's `new Dockerfile({ stages })` takes it. */
|
|
588
718
|
export interface CiImageStage {
|
|
@@ -736,6 +866,8 @@ export function productImageStages(spec: ProductImageSpec): CiImageStage[] {
|
|
|
736
866
|
for (const p of spec.npm ?? []) if (!PKG.test(p)) throw new Error(`npm package ${JSON.stringify(p)} is not a name at an exact version`);
|
|
737
867
|
if (spec.chant !== undefined && !VERSION.test(spec.chant)) throw new Error(`chant ${JSON.stringify(spec.chant)} is not a release version`);
|
|
738
868
|
const root = spec.toolRoot ?? `/opt/${spec.product}`;
|
|
869
|
+
// An image's COPY takes no shell variable, so the tool root is a plain path here.
|
|
870
|
+
if (!DIR.test(root)) throw new Error(`toolRoot ${JSON.stringify(root)} is not an absolute path of letters, digits and ._/-`);
|
|
739
871
|
const tools = spec.tools ?? [];
|
|
740
872
|
const seen = new Set<string>();
|
|
741
873
|
for (const t of tools) {
|
package/src/ci-jobs.ts
CHANGED
|
@@ -339,6 +339,9 @@ const USES_PATTERN = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)((?:\/[A-Za-z0-9_.-]+
|
|
|
339
339
|
export function assertSetupSteps(name: string, setup: OpSetupStep[]): void {
|
|
340
340
|
setup.forEach((step, index) => {
|
|
341
341
|
const where = `Scheduled Op "${name}" setup step ${index + 1}`;
|
|
342
|
+
if (step.name !== undefined && (step.name.trim() === "" || /[\r\n]/.test(step.name))) {
|
|
343
|
+
throw new Error(`${where} has a blank or multi-line \`name\`. Give the step a one-line name, or leave it out.`);
|
|
344
|
+
}
|
|
342
345
|
if ("uses" in step) {
|
|
343
346
|
const ref = step.uses.trim();
|
|
344
347
|
const match = USES_PATTERN.exec(ref);
|
|
@@ -368,16 +371,18 @@ export function assertSetupSteps(name: string, setup: OpSetupStep[]): void {
|
|
|
368
371
|
});
|
|
369
372
|
}
|
|
370
373
|
|
|
371
|
-
/** One setup entry as a GitHub Actions step: `with:` and `env:` only when they hold something. */
|
|
374
|
+
/** One setup entry as a GitHub Actions step: its `name` when it has one (#4932), `with:` and `env:` only when they hold something. */
|
|
372
375
|
export function setupStepDoc(step: OpSetupStep): Record<string, unknown> {
|
|
376
|
+
const name = step.name !== undefined ? { name: step.name } : {};
|
|
373
377
|
if ("uses" in step) {
|
|
374
378
|
return {
|
|
379
|
+
...name,
|
|
375
380
|
uses: step.uses,
|
|
376
381
|
...nonEmpty("with", step.with),
|
|
377
382
|
...nonEmpty("env", step.env),
|
|
378
383
|
};
|
|
379
384
|
}
|
|
380
|
-
return { run: step.run, ...nonEmpty("env", step.env) };
|
|
385
|
+
return { ...name, run: step.run, ...nonEmpty("env", step.env) };
|
|
381
386
|
}
|
|
382
387
|
|
|
383
388
|
/**
|
package/src/ci-login.test.ts
CHANGED
|
@@ -13,8 +13,8 @@ import { tmpdir } from "node:os";
|
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { promisify } from "node:util";
|
|
15
15
|
import { afterAll, beforeAll, describe, expect, test } from "vitest";
|
|
16
|
-
import { cloudLogin, forgejoCloudLogin, githubCloudLogin, gitlabCloudLogin, LOGIN_JS, LOGIN_SPEC_ENV, type CloudLoginSpec, type LoginForge } from "./ci-login";
|
|
17
|
-
import { CLOUD_TARGETS_ENV, resolveCloudIdentity, targetCloudEnv, type CloudIdentityDeclaration } from "./ci-identity";
|
|
16
|
+
import { cloudLogin, cloudLoginSpec, forgejoCloudLogin, githubCloudLogin, GITLAB_LOGIN_VARS, gitlabCloudLogin, LOGIN_JS, LOGIN_SPEC_ENV, type CloudLoginSpec, type LoginForge } from "./ci-login";
|
|
17
|
+
import { CLOUD_TARGETS_ENV, CLOUD_TRADED_ENV, cloudsTraded, resolveCloudIdentity, targetCloudEnv, TRADE_SPEC_ENV, tradeLine, type CloudIdentityDeclaration, type CloudTradeSpec } from "./ci-identity";
|
|
18
18
|
import { EMULATED_JWT_PREFIX, startOidcEmulator, type OidcEmulator } from "./__fixtures__/oidc-emulator";
|
|
19
19
|
|
|
20
20
|
const run = promisify(execFile);
|
|
@@ -78,7 +78,7 @@ describe("the rendered login (#4788)", () => {
|
|
|
78
78
|
expect(() => githubCloudLogin({ pulumi: { organization: "o", audience: "a", token: "team:x" } } as unknown as CloudLoginSpec)).toThrow(/Pulumi Cloud\) is traded/);
|
|
79
79
|
expect(() => githubCloudLogin({ azure: { ...SPEC.azure!, database: true } } as unknown as CloudLoginSpec)).toThrow(/no database token/);
|
|
80
80
|
expect(() => githubCloudLogin({ aws: { role: "arn:aws:iam::1:role/a b" } })).toThrow(/role is .*printable ASCII with no space/);
|
|
81
|
-
expect(() => githubCloudLogin({
|
|
81
|
+
expect(() => githubCloudLogin({ azure: { tenantId: TENANT } })).toThrow(/names no identity/);
|
|
82
82
|
expect(() => githubCloudLogin({ aws: { role: "r", sessionName: "x" } })).toThrow(/sessionName/);
|
|
83
83
|
expect(() => githubCloudLogin({ aws: { role: "r", tokenFile: "$(id)" } })).toThrow(/tokenFile/);
|
|
84
84
|
expect(() => githubCloudLogin({ azure: { tenantId: TENANT, targets: [{ targets: ["a"], clientId: "c" }], cli: true } })).toThrow(/needs clientId/);
|
|
@@ -233,3 +233,131 @@ describe("the login, run (#4788)", () => {
|
|
|
233
233
|
expect(lines[1]).toBe(`account set --subscription ${SPEC.azure!.subscriptionId}`);
|
|
234
234
|
});
|
|
235
235
|
});
|
|
236
|
+
|
|
237
|
+
describe("the gaps terragucci's login needs closed (#4930)", () => {
|
|
238
|
+
let emu: OidcEmulator;
|
|
239
|
+
beforeAll(async () => {
|
|
240
|
+
emu = await startOidcEmulator();
|
|
241
|
+
});
|
|
242
|
+
afterAll(async () => {
|
|
243
|
+
await emu.close();
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const parseEnv = (text: string): Record<string, string> => Object.fromEntries(text.trim().split("\n").filter(Boolean).map((l) => [l.slice(0, l.indexOf("=")), l.slice(l.indexOf("=") + 1)]));
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Runs a login and then `env` in one shell with -e off, as terragucci's
|
|
250
|
+
* steps run (they read each stage's exit code): the variables the same
|
|
251
|
+
* step sees, and what `$GITHUB_ENV` got.
|
|
252
|
+
*/
|
|
253
|
+
async function oneStep(forge: LoginForge, spec: CloudLoginSpec, sameStep: boolean, env: Record<string, string> = {}) {
|
|
254
|
+
const dir = mkdtempSync(join(tmpdir(), "chant-login-4930-"));
|
|
255
|
+
const githubEnv = join(dir, "github-env");
|
|
256
|
+
writeFileSync(githubEnv, "");
|
|
257
|
+
const { steps, idTokens } = cloudLogin(forge, spec, { sameStep });
|
|
258
|
+
const tokens = forge === "gitlab" ? Object.fromEntries(Object.keys(idTokens).map((k) => [k, `eyJgitlab.${k}.1`])) : emu.requestEnv;
|
|
259
|
+
const script = ["set +e", ...steps[0]!.run, "env"].join("\n");
|
|
260
|
+
const r = await run("bash", ["-c", script], { env: { PATH: process.env.PATH!, GITHUB_ENV: githubEnv, RUNNER_TEMP: dir, TMPDIR: dir, ...tokens, ...env } }).catch((e: { stdout: string; stderr: string; code: number }) => ({ stdout: e.stdout, stderr: e.stderr, failed: e.code }));
|
|
261
|
+
return { dir, step: parseEnv(r.stdout), githubEnv: parseEnv(readFileSync(githubEnv, "utf-8")), run: r };
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
test.each(FORGES)("%s: a spec with no region leaves the job's region, and one that names it sets it as before", async (forge) => {
|
|
265
|
+
const none = await oneStep(forge, { aws: { role: "arn:aws:iam::1:role/p" } }, true, { AWS_REGION: "ap-south-1", AWS_DEFAULT_REGION: "ap-south-1" });
|
|
266
|
+
expect(none.step).toMatchObject({ AWS_ROLE_ARN: "arn:aws:iam::1:role/p", AWS_REGION: "ap-south-1", AWS_DEFAULT_REGION: "ap-south-1" });
|
|
267
|
+
const unset = await oneStep(forge, { aws: { role: "arn:aws:iam::1:role/p" } }, true);
|
|
268
|
+
expect(unset.step.AWS_REGION).toBeUndefined();
|
|
269
|
+
expect(unset.step.AWS_DEFAULT_REGION).toBeUndefined();
|
|
270
|
+
expect(cloudLoginSpec({ aws: { role: "r" } })).toEqual({ aws: { role: "r", audience: "sts.amazonaws.com" } });
|
|
271
|
+
const named = await oneStep(forge, SPEC, true);
|
|
272
|
+
expect(named.step).toMatchObject({ AWS_REGION: "eu-west-1", AWS_DEFAULT_REGION: "eu-west-1" });
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test("a spec that names a region renders as before: the same spec, in the same order", () => {
|
|
276
|
+
expect(cloudLoginSpec(SPEC).aws).toEqual({ role: SPEC.aws!.role, region: "eu-west-1", sessionName: "terragucci-plan", audience: "sts.amazonaws.com" });
|
|
277
|
+
expect(Object.keys(cloudLoginSpec(SPEC).aws!)).toEqual(["role", "region", "sessionName", "audience"]);
|
|
278
|
+
expect(Object.keys(cloudLoginSpec({ aws: { region: "eu-west-1", role: "r" } }).aws!)).toEqual(["region", "role", "audience"]);
|
|
279
|
+
for (const forge of FORGES) expect(cloudLogin(forge, SPEC, { sameStep: false })).toEqual(cloudLogin(forge, SPEC));
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test.each(["github", "forgejo"] as const)("%s: sameStep exports into the step that runs the login, and leaves $GITHUB_ENV alone", async (forge) => {
|
|
283
|
+
const { step, githubEnv, run: r } = await oneStep(forge, SPEC, true);
|
|
284
|
+
expect(r).not.toHaveProperty("failed");
|
|
285
|
+
expect(githubEnv).toEqual({});
|
|
286
|
+
expect(step).toMatchObject({ AWS_ROLE_ARN: SPEC.aws!.role, ARM_CLIENT_ID: SPEC.azure!.clientId });
|
|
287
|
+
expect(readFileSync(step.AWS_WEB_IDENTITY_TOKEN_FILE!, "utf-8")).toContain(Buffer.from(AUD.aws).toString("base64url"));
|
|
288
|
+
expect(JSON.parse(readFileSync(step.GOOGLE_APPLICATION_CREDENTIALS!, "utf-8")).type).toBe("external_account");
|
|
289
|
+
for (const k of [LOGIN_SPEC_ENV, GITLAB_LOGIN_VARS]) expect(step[k]).toBeUndefined();
|
|
290
|
+
// Without it, the step itself sees nothing: the variables are for later steps.
|
|
291
|
+
const later = await oneStep(forge, SPEC, false);
|
|
292
|
+
expect(later.step.AWS_ROLE_ARN).toBeUndefined();
|
|
293
|
+
expect(later.githubEnv.AWS_ROLE_ARN).toBe(SPEC.aws!.role);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("gitlab: sameStep is the script's own lines, as before, and the id_tokens variables are unset", async () => {
|
|
297
|
+
const { step, run: r } = await oneStep("gitlab", SPEC, true);
|
|
298
|
+
expect(r).not.toHaveProperty("failed");
|
|
299
|
+
expect(step).toMatchObject({ AWS_ROLE_ARN: SPEC.aws!.role });
|
|
300
|
+
expect(readFileSync(step.AWS_WEB_IDENTITY_TOKEN_FILE!, "utf-8")).toBe("eyJgitlab.CHANT_ID_TOKEN_AWS.1");
|
|
301
|
+
for (const k of ["CHANT_ID_TOKEN_AWS", "CHANT_ID_TOKEN_GCP", "CHANT_ID_TOKEN_AZURE", LOGIN_SPEC_ENV]) expect(step[k]).toBeUndefined();
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
test.each(FORGES)("%s: sameStep stops the step on a failed login even with -e off, before the next line", async (forge) => {
|
|
305
|
+
const { run: r, step } = await oneStep(forge, { aws: { role: "r", tokenFile: "$NOWHERE/token" } }, true, { NOWHERE: "/nonexistent-4930" });
|
|
306
|
+
expect(r).toMatchObject({ failed: 1, stderr: expect.stringContaining("aws's tokenFile /nonexistent-4930/token cannot be read") });
|
|
307
|
+
expect(step).toEqual({});
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
test.each(FORGES)("%s: an AWS spec with no role points the job at the token file alone, as a Terragrunt credentials job takes it", async (forge) => {
|
|
311
|
+
const dir = mkdtempSync(join(tmpdir(), "chant-login-4930-tok-"));
|
|
312
|
+
writeFileSync(join(dir, "aws"), "eyJstaged.token.1\n");
|
|
313
|
+
expect(cloudLogin(forge, { aws: { tokenFile: "$STAGED/aws" } }).idTokens).toEqual({});
|
|
314
|
+
const staged = await oneStep(forge, { aws: { tokenFile: "$STAGED/aws", sessionName: "terragucci-plan" } }, true, { STAGED: dir });
|
|
315
|
+
expect(staged.run).not.toHaveProperty("failed");
|
|
316
|
+
expect(staged.step).toMatchObject({ AWS_WEB_IDENTITY_TOKEN_FILE: join(dir, "aws"), AWS_ROLE_SESSION_NAME: "terragucci-plan" });
|
|
317
|
+
expect(staged.step.AWS_ROLE_ARN).toBeUndefined();
|
|
318
|
+
// With no tokenFile the job requests the token, as for a role.
|
|
319
|
+
expect(cloudLogin(forge, { aws: {} }).idTokens).toEqual({ CHANT_ID_TOKEN_AWS: AUD.aws });
|
|
320
|
+
const requested = await oneStep(forge, { aws: {} }, true);
|
|
321
|
+
expect(readFileSync(requested.step.AWS_WEB_IDENTITY_TOKEN_FILE!, "utf-8")).toMatch(forge === "gitlab" ? /^eyJgitlab\.CHANT_ID_TOKEN_AWS\.1$/ : new RegExp(Buffer.from(AUD.aws).toString("base64url")));
|
|
322
|
+
expect(requested.step.AWS_ROLE_SESSION_NAME).toBe("chant");
|
|
323
|
+
// GCP and Azure still need an identity: their files and variables name one.
|
|
324
|
+
expect(() => cloudLogin(forge, { gcp: { provider: PROVIDER } })).toThrow(/names no identity/);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("an AWS spec with roles by target and none of its own: each target's role, and the token file for the rest", async () => {
|
|
328
|
+
const { step } = await oneStep("github", { aws: { targets: [{ targets: ["envs/prod/**"], role: "arn:aws:iam::1:role/prod" }] } }, true, { AWS_REGION: "ap-south-1" });
|
|
329
|
+
expect(step.AWS_ROLE_ARN).toBeUndefined();
|
|
330
|
+
expect(step.AWS_WEB_IDENTITY_TOKEN_FILE).toBeDefined();
|
|
331
|
+
const prod = targetCloudEnv(step, "envs/prod/net");
|
|
332
|
+
expect(prod).toMatchObject({ AWS_ROLE_ARN: "arn:aws:iam::1:role/prod", AWS_WEB_IDENTITY_TOKEN_FILE: step.AWS_WEB_IDENTITY_TOKEN_FILE, AWS_REGION: "ap-south-1" });
|
|
333
|
+
expect(targetCloudEnv(step, "envs/dev/net").AWS_ROLE_ARN).toBeUndefined();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test.each(FORGES)("%s: a login's targets file is no trade's: CHANT_CLOUD_TRADED stays unset", async (forge) => {
|
|
337
|
+
const spec: CloudLoginSpec = { aws: { role: "arn:aws:iam::1:role/default", targets: [{ targets: ["envs/prod/**"], role: "arn:aws:iam::1:role/prod" }] } };
|
|
338
|
+
const { step } = await oneStep(forge, spec, true);
|
|
339
|
+
expect(step[CLOUD_TARGETS_ENV]).toBeDefined();
|
|
340
|
+
expect(step[CLOUD_TRADED_ENV]).toBeUndefined();
|
|
341
|
+
expect(cloudsTraded(step)).toEqual([]);
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
test("the trade says it traded, with or without targets, so its targets file is told from a login's", async () => {
|
|
345
|
+
const dir = mkdtempSync(join(tmpdir(), "chant-trade-4930-"));
|
|
346
|
+
const trade = async (spec: CloudTradeSpec): Promise<Record<string, string>> => {
|
|
347
|
+
const file = join(dir, `github-env-${Math.random().toString(16).slice(2)}`);
|
|
348
|
+
writeFileSync(file, "");
|
|
349
|
+
await run("sh", ["-c", tradeLine(file, "github-env")], { env: { PATH: process.env.PATH!, ...emu.requestEnv, RUNNER_TEMP: dir, [TRADE_SPEC_ENV]: JSON.stringify(emu.pointAt(spec)) } });
|
|
350
|
+
return parseEnv(readFileSync(file, "utf-8"));
|
|
351
|
+
};
|
|
352
|
+
const aws = { role: "arn:aws:iam::1:role/default", region: "eu-west-1", audience: "sts.amazonaws.com" };
|
|
353
|
+
const targeted = await trade({ aws: { ...aws, targets: [{ targets: ["envs/prod/**"], role: "arn:aws:iam::1:role/prod" }] }, gcp: { serviceAccount: "plan@p.iam.gserviceaccount.com", provider: PROVIDER, audience: AUD.gcp } });
|
|
354
|
+
expect(targeted[CLOUD_TARGETS_ENV]).toBeDefined();
|
|
355
|
+
expect(targeted[CLOUD_TRADED_ENV]).toBe("aws,gcp");
|
|
356
|
+
expect(cloudsTraded(targeted)).toEqual(["aws", "gcp"]);
|
|
357
|
+
// A trade's identity sets its own region, so a target still gets it.
|
|
358
|
+
expect(targetCloudEnv({ ...targeted, AWS_REGION: "ap-south-1" }, "envs/prod/net").AWS_REGION).toBe("eu-west-1");
|
|
359
|
+
const plain = await trade({ aws });
|
|
360
|
+
expect(plain[CLOUD_TARGETS_ENV]).toBeUndefined();
|
|
361
|
+
expect(plain[CLOUD_TRADED_ENV]).toBe("aws");
|
|
362
|
+
});
|
|
363
|
+
});
|