@intentius/chant 0.124.54 → 0.124.56
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/__fixtures__/estate-ledger.d.ts +13 -0
- package/dist/__fixtures__/estate-ledger.d.ts.map +1 -0
- package/dist/__fixtures__/estate-ledger.js +67 -0
- package/dist/__fixtures__/oidc-emulator.d.ts +11 -1
- package/dist/__fixtures__/oidc-emulator.d.ts.map +1 -1
- package/dist/__fixtures__/oidc-emulator.js +26 -2
- package/dist/__fixtures__/product-words.d.ts +78 -0
- package/dist/__fixtures__/product-words.d.ts.map +1 -0
- package/dist/__fixtures__/product-words.js +43 -0
- package/dist/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-hold.json +20 -4
- package/dist/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-pass.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-skip.json +10 -2
- package/dist/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
- package/dist/__golden__/wave-loop/op-discover-rest.json +44 -12
- package/dist/__golden__/wave-loop/op-discover-wide.json +12 -3
- package/dist/__golden__/wave-loop/op-held-on.json +28 -7
- package/dist/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
- package/dist/__golden__/wave-loop/op-hooks-held.json +26 -8
- package/dist/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
- package/dist/__golden__/wave-loop/op-hooks-pass.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-share.json +20 -7
- package/dist/__golden__/wave-loop/op-outcome-held.json +12 -3
- package/dist/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
- package/dist/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
- package/dist/__golden__/wave-loop/op-outcome-replan.json +16 -5
- package/dist/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
- package/dist/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
- package/dist/__golden__/wave-loop/op-overridden.json +28 -7
- package/dist/__golden__/wave-loop/op-per-run.json +20 -4
- package/dist/__golden__/wave-loop/op-point.json +18 -4
- package/dist/__golden__/wave-loop/op-pr-review.json +10 -2
- package/dist/__golden__/wave-loop/op-spend-change-only.json +10 -2
- package/dist/__golden__/wave-loop/op-spend.json +10 -2
- package/dist/__golden__/wave-loop/op-wave-commands.json +56 -13
- package/dist/__golden__/wave-loop/op-wide.json +20 -4
- package/dist/bucket-check/azure.d.ts +108 -0
- package/dist/bucket-check/azure.d.ts.map +1 -0
- package/dist/bucket-check/azure.js +258 -0
- package/dist/bucket-check/fixtures/azure.json +153 -0
- package/dist/bucket-check/fixtures/gcs.json +148 -0
- package/dist/bucket-check/fixtures/s3.json +277 -0
- package/dist/bucket-check/gcs.d.ts +77 -0
- package/dist/bucket-check/gcs.d.ts.map +1 -0
- package/dist/bucket-check/gcs.js +202 -0
- package/dist/bucket-check/index.d.ts +48 -0
- package/dist/bucket-check/index.d.ts.map +1 -0
- package/dist/bucket-check/index.js +44 -0
- package/dist/bucket-check/s3.d.ts +116 -0
- package/dist/bucket-check/s3.d.ts.map +1 -0
- package/dist/bucket-check/s3.js +362 -0
- package/dist/bucket-check/types.d.ts +66 -0
- package/dist/bucket-check/types.d.ts.map +1 -0
- package/dist/bucket-check/types.js +31 -0
- package/dist/bucket-check/wire.d.ts +27 -0
- package/dist/bucket-check/wire.d.ts.map +1 -0
- package/dist/bucket-check/wire.js +32 -0
- package/dist/bucket-check.d.ts +6 -0
- package/dist/bucket-check.d.ts.map +1 -0
- package/dist/bucket-check.js +5 -0
- package/dist/capabilities/templates.d.ts.map +1 -1
- package/dist/capabilities/templates.js +1 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +2 -3
- package/dist/ci-agent.d.ts +381 -0
- package/dist/ci-agent.d.ts.map +1 -0
- package/dist/ci-agent.js +832 -0
- package/dist/ci-audit/attribution.d.ts +111 -0
- package/dist/ci-audit/attribution.d.ts.map +1 -0
- package/dist/ci-audit/attribution.js +194 -0
- package/dist/ci-audit/audit-log.d.ts +144 -0
- package/dist/ci-audit/audit-log.d.ts.map +1 -0
- package/dist/ci-audit/audit-log.js +149 -0
- package/dist/ci-audit/index.d.ts +12 -0
- package/dist/ci-audit/index.d.ts.map +1 -0
- package/dist/ci-audit/index.js +12 -0
- package/dist/ci-audit/unrecorded.d.ts +74 -0
- package/dist/ci-audit/unrecorded.d.ts.map +1 -0
- package/dist/ci-audit/unrecorded.js +95 -0
- package/dist/ci-audit.d.ts +3 -0
- package/dist/ci-audit.d.ts.map +1 -0
- package/dist/ci-audit.js +2 -0
- package/dist/ci-control.d.ts +42 -0
- package/dist/ci-control.d.ts.map +1 -0
- package/dist/ci-control.js +41 -0
- package/dist/ci-estate/delivery.d.ts +137 -0
- package/dist/ci-estate/delivery.d.ts.map +1 -0
- package/dist/ci-estate/delivery.js +311 -0
- package/dist/ci-estate/overdue.d.ts +34 -0
- package/dist/ci-estate/overdue.d.ts.map +1 -0
- package/dist/ci-estate/overdue.js +58 -0
- package/dist/ci-estate/page.d.ts +134 -0
- package/dist/ci-estate/page.d.ts.map +1 -0
- package/dist/ci-estate/page.js +233 -0
- package/dist/ci-estate/rows.d.ts +118 -0
- package/dist/ci-estate/rows.d.ts.map +1 -0
- package/dist/ci-estate/rows.js +126 -0
- package/dist/ci-estate.d.ts +92 -0
- package/dist/ci-estate.d.ts.map +1 -0
- package/dist/ci-estate.js +82 -0
- package/dist/ci-handover.d.ts +29 -5
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +50 -16
- package/dist/ci-identity.d.ts +82 -7
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +86 -15
- package/dist/ci-job-guard.d.ts +139 -0
- package/dist/ci-job-guard.d.ts.map +1 -0
- package/dist/ci-job-guard.js +287 -0
- package/dist/ci-jobs.d.ts +7 -0
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -0
- package/dist/ci-product-words.d.ts +296 -0
- package/dist/ci-product-words.d.ts.map +1 -0
- package/dist/ci-product-words.js +407 -0
- package/dist/ci-product.d.ts +117 -0
- package/dist/ci-product.d.ts.map +1 -0
- package/dist/ci-product.js +113 -0
- package/dist/ci-respond-run.d.ts +73 -0
- package/dist/ci-respond-run.d.ts.map +1 -0
- package/dist/ci-respond-run.js +247 -0
- package/dist/ci-respond.d.ts +189 -0
- package/dist/ci-respond.d.ts.map +1 -0
- package/dist/ci-respond.js +285 -0
- package/dist/cli/commands/audit.d.ts +2 -2
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +3 -2
- package/dist/cli/commands/carve.js +2 -2
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1 -1
- package/dist/cli/handlers/agent.d.ts +17 -0
- package/dist/cli/handlers/agent.d.ts.map +1 -0
- package/dist/cli/handlers/agent.js +114 -0
- package/dist/cli/handlers/approve-confirm.d.ts +84 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -0
- package/dist/cli/handlers/approve-confirm.js +142 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +19 -1
- package/dist/cli/handlers/audit-log.d.ts +12 -0
- package/dist/cli/handlers/audit-log.d.ts.map +1 -0
- package/dist/cli/handlers/audit-log.js +81 -0
- package/dist/cli/handlers/build.d.ts +7 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +124 -1
- package/dist/cli/handlers/ci-check-job.d.ts +11 -0
- package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check-job.js +27 -0
- package/dist/cli/handlers/ci-check.d.ts +3 -0
- package/dist/cli/handlers/ci-check.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check.js +63 -0
- package/dist/cli/handlers/ci-forge-check.d.ts +3 -0
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -0
- package/dist/cli/handlers/ci-forge-check.js +89 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts +12 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
- package/dist/cli/handlers/e2e-safe-run.js +23 -0
- package/dist/cli/handlers/fan-out.js +4 -0
- package/dist/cli/handlers/gate-pending.d.ts +11 -0
- package/dist/cli/handlers/gate-pending.d.ts.map +1 -0
- package/dist/cli/handlers/gate-pending.js +44 -0
- package/dist/cli/handlers/init.d.ts.map +1 -1
- package/dist/cli/handlers/init.js +1 -0
- package/dist/cli/handlers/ledger.js +1 -1
- package/dist/cli/handlers/lifecycle-drift.d.ts +6 -2
- package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle-drift.js +7 -2
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +64 -5
- package/dist/cli/handlers/notify-relay.d.ts +15 -0
- package/dist/cli/handlers/notify-relay.d.ts.map +1 -0
- package/dist/cli/handlers/notify-relay.js +130 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +42 -11
- package/dist/cli/handlers/pr.d.ts +43 -3
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +908 -205
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +21 -2
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +3 -0
- package/dist/cli/handlers/run-wave.d.ts +8 -0
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +160 -2
- package/dist/cli/handlers/run.d.ts +6 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +86 -1
- package/dist/cli/handlers/serve.d.ts.map +1 -1
- package/dist/cli/handlers/serve.js +10 -1
- package/dist/cli/main.d.ts +11 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +178 -13
- package/dist/cli/mcp/ledger-tools.d.ts +36 -0
- package/dist/cli/mcp/ledger-tools.d.ts.map +1 -0
- package/dist/cli/mcp/ledger-tools.js +122 -0
- package/dist/cli/mcp/product-tools.d.ts +78 -0
- package/dist/cli/mcp/product-tools.d.ts.map +1 -0
- package/dist/cli/mcp/product-tools.js +93 -0
- package/dist/cli/mcp/read-only.d.ts +34 -0
- package/dist/cli/mcp/read-only.d.ts.map +1 -0
- package/dist/cli/mcp/read-only.js +61 -0
- package/dist/cli/mcp/report-tools.d.ts +48 -0
- package/dist/cli/mcp/report-tools.d.ts.map +1 -0
- package/dist/cli/mcp/report-tools.js +128 -0
- package/dist/cli/mcp/server.d.ts +28 -1
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/server.js +86 -15
- package/dist/cli/mcp-config.d.ts +9 -2
- package/dist/cli/mcp-config.d.ts.map +1 -1
- package/dist/cli/mcp-config.js +8 -3
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +164 -3
- package/dist/cli/registry.d.ts +73 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cloud-lister/sigv4.d.ts +42 -7
- package/dist/cloud-lister/sigv4.d.ts.map +1 -1
- package/dist/cloud-lister/sigv4.js +72 -22
- package/dist/components/adoption.d.ts +69 -0
- package/dist/components/adoption.d.ts.map +1 -0
- package/dist/components/adoption.js +92 -0
- package/dist/components/apply-lease.d.ts +19 -0
- package/dist/components/apply-lease.d.ts.map +1 -0
- package/dist/components/apply-lease.js +41 -0
- package/dist/components/capability.d.ts +159 -5
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +39 -6
- package/dist/components/check-hooks.d.ts +116 -0
- package/dist/components/check-hooks.d.ts.map +1 -0
- package/dist/components/check-hooks.js +192 -0
- package/dist/components/check-steps.d.ts +74 -0
- package/dist/components/check-steps.d.ts.map +1 -0
- package/dist/components/check-steps.js +102 -0
- package/dist/components/ci-services.d.ts +57 -0
- package/dist/components/ci-services.d.ts.map +1 -0
- package/dist/components/ci-services.js +60 -0
- package/dist/components/cli-support.d.ts +13 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +10 -2
- package/dist/components/driver.d.ts +32 -3
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +59 -5
- package/dist/components/fan-out-run.d.ts +12 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +56 -16
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +23 -5
- package/dist/components/pr-env-ledger.d.ts +32 -0
- package/dist/components/pr-env-ledger.d.ts.map +1 -0
- package/dist/components/pr-env-ledger.js +38 -0
- package/dist/components/pr-env-ports.d.ts +12 -0
- package/dist/components/pr-env-ports.d.ts.map +1 -1
- package/dist/components/pr-env-ports.js +13 -3
- package/dist/components/pr-env-run.d.ts +6 -0
- package/dist/components/pr-env-run.d.ts.map +1 -1
- package/dist/components/pr-env-run.js +3 -2
- package/dist/components/pr-environment.d.ts +32 -4
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +26 -8
- package/dist/components/pr-pipeline.d.ts +297 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +329 -18
- package/dist/components/pr-policy.d.ts +26 -2
- package/dist/components/pr-policy.d.ts.map +1 -1
- package/dist/components/pr-policy.js +41 -7
- package/dist/components/pr-run.d.ts +71 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +91 -7
- package/dist/components/pr-targets.d.ts +24 -0
- package/dist/components/pr-targets.d.ts.map +1 -0
- package/dist/components/pr-targets.js +48 -0
- package/dist/components/product-pipeline.d.ts +250 -0
- package/dist/components/product-pipeline.d.ts.map +1 -0
- package/dist/components/product-pipeline.js +212 -0
- package/dist/components/promote.d.ts +6 -0
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +4 -1
- package/dist/components/release-compile.d.ts +22 -1
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +85 -0
- package/dist/components/release-promote.d.ts +15 -1
- package/dist/components/release-promote.d.ts.map +1 -1
- package/dist/components/release-promote.js +67 -2
- package/dist/components/repo-lock.d.ts +27 -0
- package/dist/components/repo-lock.d.ts.map +1 -0
- package/dist/components/repo-lock.js +49 -0
- package/dist/components/row-lease.d.ts +84 -0
- package/dist/components/row-lease.d.ts.map +1 -0
- package/dist/components/row-lease.js +110 -0
- package/dist/components/wave-plan.d.ts +42 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +72 -4
- package/dist/control/applied.d.ts +89 -0
- package/dist/control/applied.d.ts.map +1 -0
- package/dist/control/applied.js +175 -0
- package/dist/control/consumers.d.ts +78 -0
- package/dist/control/consumers.d.ts.map +1 -0
- package/dist/control/consumers.js +172 -0
- package/dist/control/dispatch.d.ts +334 -0
- package/dist/control/dispatch.d.ts.map +1 -0
- package/dist/control/dispatch.js +519 -0
- package/dist/control/edges.d.ts +75 -0
- package/dist/control/edges.d.ts.map +1 -0
- package/dist/control/edges.js +133 -0
- package/dist/control/reconcile.d.ts +120 -0
- package/dist/control/reconcile.d.ts.map +1 -0
- package/dist/control/reconcile.js +178 -0
- package/dist/control/records.d.ts +187 -0
- package/dist/control/records.d.ts.map +1 -0
- package/dist/control/records.js +307 -0
- package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +25 -1
- package/dist/e2e-harness/bucket.d.ts +21 -0
- package/dist/e2e-harness/bucket.d.ts.map +1 -0
- package/dist/e2e-harness/bucket.js +61 -0
- package/dist/e2e-harness/claim.d.ts +70 -0
- package/dist/e2e-harness/claim.d.ts.map +1 -0
- package/dist/e2e-harness/claim.js +98 -0
- package/dist/e2e-harness/driver.d.ts +64 -0
- package/dist/e2e-harness/driver.d.ts.map +1 -0
- package/dist/e2e-harness/driver.js +243 -0
- package/dist/e2e-harness/forgejo.d.ts +77 -0
- package/dist/e2e-harness/forgejo.d.ts.map +1 -0
- package/dist/e2e-harness/forgejo.js +205 -0
- package/dist/e2e-harness/git.d.ts +32 -0
- package/dist/e2e-harness/git.d.ts.map +1 -0
- package/dist/e2e-harness/git.js +67 -0
- package/dist/e2e-harness/index.d.ts +22 -0
- package/dist/e2e-harness/index.d.ts.map +1 -0
- package/dist/e2e-harness/index.js +48 -0
- package/dist/e2e-harness/jobs.d.ts +8 -0
- package/dist/e2e-harness/jobs.d.ts.map +1 -0
- package/dist/e2e-harness/jobs.js +34 -0
- package/dist/e2e-harness/pins.d.ts +45 -0
- package/dist/e2e-harness/pins.d.ts.map +1 -0
- package/dist/e2e-harness/pins.js +44 -0
- package/dist/e2e-harness/ports.d.ts +113 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -0
- package/dist/e2e-harness/ports.js +4 -0
- package/dist/e2e-harness/reports.d.ts +45 -0
- package/dist/e2e-harness/reports.d.ts.map +1 -0
- package/dist/e2e-harness/reports.js +57 -0
- package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
- package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run-cli.js +43 -0
- package/dist/e2e-harness/safe-run.d.ts +61 -0
- package/dist/e2e-harness/safe-run.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run.js +172 -0
- package/dist/e2e-harness/scenario.d.ts +11 -0
- package/dist/e2e-harness/scenario.d.ts.map +1 -0
- package/dist/e2e-harness/scenario.js +89 -0
- package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/dist/e2e-harness/schemas/index.d.ts +191 -0
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
- package/dist/e2e-harness/schemas/index.js +62 -0
- package/dist/e2e-harness/stack.d.ts +124 -0
- package/dist/e2e-harness/stack.d.ts.map +1 -0
- package/dist/e2e-harness/stack.js +207 -0
- package/dist/e2e-harness/steps.d.ts +11 -0
- package/dist/e2e-harness/steps.d.ts.map +1 -0
- package/dist/e2e-harness/steps.js +22 -0
- package/dist/e2e-harness.d.ts +3 -0
- package/dist/e2e-harness.d.ts.map +1 -0
- package/dist/e2e-harness.js +2 -0
- package/dist/engine-facts.d.ts.map +1 -1
- package/dist/engine-facts.js +1 -2
- package/dist/exit-codes.d.ts +54 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +55 -0
- package/dist/forge-check/check.d.ts +63 -0
- package/dist/forge-check/check.d.ts.map +1 -0
- package/dist/forge-check/check.js +139 -0
- package/dist/forge-check/contract.d.ts +152 -0
- package/dist/forge-check/contract.d.ts.map +1 -0
- package/dist/forge-check/contract.js +118 -0
- package/dist/forge-check/forge.d.ts +42 -0
- package/dist/forge-check/forge.d.ts.map +1 -0
- package/dist/forge-check/forge.js +338 -0
- package/dist/forge-check/index.d.ts +24 -0
- package/dist/forge-check/index.d.ts.map +1 -0
- package/dist/forge-check/index.js +23 -0
- package/dist/forge-check/pulumi.d.ts +44 -0
- package/dist/forge-check/pulumi.d.ts.map +1 -0
- package/dist/forge-check/pulumi.js +184 -0
- package/dist/forge-check/read-only.d.ts +26 -0
- package/dist/forge-check/read-only.d.ts.map +1 -0
- package/dist/forge-check/read-only.js +53 -0
- package/dist/forge-check/trust.d.ts +94 -0
- package/dist/forge-check/trust.d.ts.map +1 -0
- package/dist/forge-check/trust.js +532 -0
- package/dist/forge-check/types.d.ts +80 -0
- package/dist/forge-check/types.d.ts.map +1 -0
- package/dist/forge-check/types.js +18 -0
- package/dist/forge-check.d.ts +6 -0
- package/dist/forge-check.d.ts.map +1 -0
- package/dist/forge-check.js +5 -0
- package/dist/gate-decision.d.ts +1 -0
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +2 -0
- package/dist/gate-policy.d.ts +47 -1
- package/dist/gate-policy.d.ts.map +1 -1
- package/dist/gate-policy.js +50 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lexicon.d.ts +152 -6
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.d.ts +24 -0
- package/dist/lifecycle/adoption-file.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.js +1 -2
- package/dist/lifecycle/cloud-index.d.ts.map +1 -1
- package/dist/lifecycle/cloud-index.js +1 -2
- package/dist/lifecycle/gate-applied.d.ts +6 -0
- package/dist/lifecycle/gate-applied.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +29 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +10 -1
- package/dist/lifecycle/gate-pending-by-plan.d.ts +75 -0
- package/dist/lifecycle/gate-pending-by-plan.d.ts.map +1 -0
- package/dist/lifecycle/gate-pending-by-plan.js +96 -0
- package/dist/lifecycle/gated-request-digest.d.ts +28 -0
- package/dist/lifecycle/gated-request-digest.d.ts.map +1 -0
- package/dist/lifecycle/gated-request-digest.js +35 -0
- package/dist/lifecycle/gated-request.d.ts +126 -0
- package/dist/lifecycle/gated-request.d.ts.map +1 -0
- package/dist/lifecycle/gated-request.js +204 -0
- package/dist/lifecycle/identity-match.d.ts +15 -0
- package/dist/lifecycle/identity-match.d.ts.map +1 -1
- package/dist/lifecycle/identity-match.js +11 -6
- package/dist/lifecycle/index-diff.d.ts +40 -0
- package/dist/lifecycle/index-diff.d.ts.map +1 -1
- package/dist/lifecycle/index-diff.js +1 -2
- package/dist/lifecycle/index-document.d.ts.map +1 -1
- package/dist/lifecycle/index-document.js +1 -2
- package/dist/lifecycle/index-import.d.ts +4 -1
- package/dist/lifecycle/index-import.d.ts.map +1 -1
- package/dist/lifecycle/index-import.js +29 -32
- package/dist/lifecycle/ledger-read.d.ts.map +1 -1
- package/dist/lifecycle/ledger-read.js +7 -3
- package/dist/lifecycle/lock-rows.d.ts +76 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -0
- package/dist/lifecycle/lock-rows.js +140 -0
- package/dist/lifecycle/query.d.ts +50 -3
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +97 -7
- package/dist/lifecycle/release-catalog-site.d.ts +66 -0
- package/dist/lifecycle/release-catalog-site.d.ts.map +1 -0
- package/dist/lifecycle/release-catalog-site.js +232 -0
- package/dist/lifecycle/release-catalog.d.ts +201 -0
- package/dist/lifecycle/release-catalog.d.ts.map +1 -0
- package/dist/lifecycle/release-catalog.js +198 -0
- package/dist/lifecycle/release-changelog.d.ts +41 -0
- package/dist/lifecycle/release-changelog.d.ts.map +1 -0
- package/dist/lifecycle/release-changelog.js +38 -0
- package/dist/lifecycle/release-cut.d.ts +1 -0
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts +16 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +9 -0
- package/dist/lifecycle/release-publish.d.ts +43 -22
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-read.d.ts.map +1 -1
- package/dist/lifecycle/release-read.js +3 -0
- package/dist/lifecycle/release-status.d.ts +106 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -0
- package/dist/lifecycle/release-status.js +115 -0
- package/dist/lifecycle/resource-lock.d.ts +120 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -0
- package/dist/lifecycle/resource-lock.js +317 -0
- package/dist/lifecycle/retention.d.ts.map +1 -1
- package/dist/lifecycle/retention.js +3 -0
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +9 -1
- package/dist/lifecycle/snapshot-store-s3.d.ts +36 -3
- package/dist/lifecycle/snapshot-store-s3.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store-s3.js +9 -44
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store.js +1 -2
- package/dist/lifecycle/target-lock.d.ts +15 -0
- package/dist/lifecycle/target-lock.d.ts.map +1 -1
- package/dist/lifecycle/target-lock.js +25 -10
- package/dist/lifecycle/wave-plans.d.ts +23 -7
- package/dist/lifecycle/wave-plans.d.ts.map +1 -1
- package/dist/lifecycle/wave-plans.js +9 -2
- package/dist/mcp/types.d.ts +7 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/notify-product.d.ts +43 -0
- package/dist/notify-product.d.ts.map +1 -0
- package/dist/notify-product.js +58 -0
- package/dist/notify-relay.d.ts +197 -0
- package/dist/notify-relay.d.ts.map +1 -0
- package/dist/notify-relay.js +321 -0
- package/dist/notify.d.ts +44 -4
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +77 -14
- package/dist/object-store/azure-blob.d.ts +129 -0
- package/dist/object-store/azure-blob.d.ts.map +1 -0
- package/dist/object-store/azure-blob.js +341 -0
- package/dist/object-store/common.d.ts +108 -0
- package/dist/object-store/common.d.ts.map +1 -0
- package/dist/object-store/common.js +80 -0
- package/dist/object-store/errors.d.ts +28 -0
- package/dist/object-store/errors.d.ts.map +1 -0
- package/dist/object-store/errors.js +21 -0
- package/dist/object-store/from-env.d.ts +18 -0
- package/dist/object-store/from-env.d.ts.map +1 -0
- package/dist/object-store/from-env.js +22 -0
- package/dist/object-store/gcs.d.ts +106 -0
- package/dist/object-store/gcs.d.ts.map +1 -0
- package/dist/object-store/gcs.js +393 -0
- package/dist/object-store/index.d.ts +9 -0
- package/dist/object-store/index.d.ts.map +1 -0
- package/dist/object-store/index.js +8 -0
- package/dist/object-store/s3.d.ts +146 -0
- package/dist/object-store/s3.d.ts.map +1 -0
- package/dist/object-store/s3.js +306 -0
- package/dist/op/activities/converge.d.ts.map +1 -1
- package/dist/op/activities/converge.js +2 -1
- package/dist/op/activities/index.d.ts +1 -1
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +1 -1
- package/dist/op/activities/review-agent.d.ts +55 -2
- package/dist/op/activities/review-agent.d.ts.map +1 -1
- package/dist/op/activities/review-agent.js +65 -5
- package/dist/op/approval-status.d.ts +103 -0
- package/dist/op/approval-status.d.ts.map +1 -0
- package/dist/op/approval-status.js +197 -0
- package/dist/op/gate.d.ts +29 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +59 -23
- package/dist/op/generate-pipeline.d.ts.map +1 -1
- package/dist/op/generate-pipeline.js +7 -1
- package/dist/op/index.d.ts +12 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +7 -1
- package/dist/op/op-waves-after-plan.d.ts +137 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -0
- package/dist/op/op-waves-after-plan.js +163 -0
- package/dist/op/op-waves-capability-spec.d.ts +63 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -0
- package/dist/op/op-waves-capability-spec.js +115 -0
- package/dist/op/op-waves-capability.d.ts +197 -0
- package/dist/op/op-waves-capability.d.ts.map +1 -0
- package/dist/op/op-waves-capability.js +311 -0
- package/dist/op/op-waves-events.d.ts +54 -0
- package/dist/op/op-waves-events.d.ts.map +1 -0
- package/dist/op/op-waves-events.js +122 -0
- package/dist/op/op-waves-notify.d.ts +7 -1
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +35 -16
- package/dist/op/op-waves-release-port.d.ts +18 -0
- package/dist/op/op-waves-release-port.d.ts.map +1 -0
- package/dist/op/op-waves-release-port.js +61 -0
- package/dist/op/op-waves-release.d.ts +92 -0
- package/dist/op/op-waves-release.d.ts.map +1 -0
- package/dist/op/op-waves-release.js +96 -0
- package/dist/op/op-waves-run.d.ts +182 -6
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +1076 -44
- package/dist/op/op-waves-stand-down.d.ts +60 -0
- package/dist/op/op-waves-stand-down.d.ts.map +1 -0
- package/dist/op/op-waves-stand-down.js +96 -0
- package/dist/op/op-waves.d.ts +187 -8
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +203 -19
- package/dist/op/runtime.d.ts +95 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +18 -0
- package/dist/op/stage-hooks.d.ts +45 -7
- package/dist/op/stage-hooks.d.ts.map +1 -1
- package/dist/op/stage-hooks.js +61 -3
- package/dist/op/steward-beside.d.ts.map +1 -1
- package/dist/op/steward-beside.js +2 -1
- package/dist/op/types.d.ts +2 -2
- package/dist/op/types.d.ts.map +1 -1
- package/dist/op/types.js +3 -2
- package/dist/otlp-metrics.d.ts +38 -0
- package/dist/otlp-metrics.d.ts.map +1 -0
- package/dist/otlp-metrics.js +82 -0
- package/dist/otlp.d.ts +249 -0
- package/dist/otlp.d.ts.map +1 -0
- package/dist/otlp.js +425 -0
- package/dist/override-gate.d.ts.map +1 -1
- package/dist/override-gate.js +5 -0
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -0
- package/dist/policy-packs.d.ts +69 -0
- package/dist/policy-packs.d.ts.map +1 -0
- package/dist/policy-packs.js +205 -0
- package/dist/policy-source.d.ts +51 -0
- package/dist/policy-source.d.ts.map +1 -0
- package/dist/policy-source.js +102 -0
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +146 -37
- package/dist/pr-loop.d.ts +158 -11
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +302 -44
- package/dist/pr-merge.d.ts +64 -0
- package/dist/pr-merge.d.ts.map +1 -0
- package/dist/pr-merge.js +78 -0
- package/dist/pr-post.d.ts +86 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +141 -5
- package/dist/pr-report-url.d.ts +32 -4
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +45 -5
- package/dist/pr-requires.d.ts +13 -2
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +14 -0
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts +26 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +3 -1
- package/dist/scheduled-op-cloud.d.ts +32 -0
- package/dist/scheduled-op-cloud.d.ts.map +1 -0
- package/dist/scheduled-op-cloud.js +69 -0
- package/dist/sorted-json.d.ts +10 -0
- package/dist/sorted-json.d.ts.map +1 -0
- package/dist/sorted-json.js +14 -0
- package/dist/terraform/credentials.d.ts +59 -0
- package/dist/terraform/credentials.d.ts.map +1 -0
- package/dist/terraform/credentials.js +149 -0
- package/dist/utils.d.ts +1 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -9
- package/dist/wave-runtime.d.ts +1 -1
- package/dist/wave-runtime.js +2 -2
- package/dist/wave-runtime.mjs +405 -287
- package/dist/workspace/chant-migrations/chud-lexicon-exit.d.ts.map +1 -1
- package/dist/workspace/chant-migrations/chud-lexicon-exit.js +4 -1
- package/dist/workspace/ci-lock-grain.d.ts +17 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -0
- package/dist/workspace/ci-lock-grain.js +21 -0
- package/dist/workspace/ci-run.d.ts +2 -1
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +10 -3
- package/dist/workspace/declaration.d.ts +16 -4
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +5 -2
- package/dist/workspace/declaration.schema.json +27 -3
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +8 -3
- package/dist/workspace/exit-cli.d.ts +1 -1
- package/dist/workspace/exit-cli.d.ts.map +1 -1
- package/dist/workspace/exit-cli.js +2 -1
- package/dist/workspace/import-fetch.d.ts +4 -2
- package/dist/workspace/import-fetch.d.ts.map +1 -1
- package/dist/workspace/import-fetch.js +4 -2
- package/dist/workspace/import-init.d.ts.map +1 -1
- package/dist/workspace/import-init.js +4 -2
- package/dist/workspace/ledger.schema.json +7 -3
- package/dist/workspace/lineage-upgrade-cli.d.ts +1 -1
- package/dist/workspace/lineage-upgrade-cli.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade-cli.js +2 -1
- package/dist/workspace/pr-report.schema.json +79 -3
- package/dist/workspace/promote.d.ts +1 -1
- package/dist/workspace/promote.d.ts.map +1 -1
- package/dist/workspace/promote.js +2 -1
- package/dist/workspace/records-cli.d.ts +2 -2
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-cli.js +3 -2
- package/dist/workspace/release-catalog.schema.json +277 -0
- package/dist/workspace/run-event.schema.json +18 -1
- package/dist/workspace/work-cli.d.ts +3 -1
- package/dist/workspace/work-cli.d.ts.map +1 -1
- package/dist/workspace/work-cli.js +7 -2
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +21 -1
- package/src/__fixtures__/estate-ledger.ts +101 -0
- package/src/__fixtures__/oidc-emulator.ts +31 -2
- package/src/__fixtures__/product-words.ts +44 -0
- package/src/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-hold.json +20 -4
- package/src/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-pass.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-skip.json +10 -2
- package/src/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
- package/src/__golden__/wave-loop/op-discover-rest.json +44 -12
- package/src/__golden__/wave-loop/op-discover-wide.json +12 -3
- package/src/__golden__/wave-loop/op-held-on.json +28 -7
- package/src/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
- package/src/__golden__/wave-loop/op-hooks-held.json +26 -8
- package/src/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
- package/src/__golden__/wave-loop/op-hooks-pass.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-share.json +20 -7
- package/src/__golden__/wave-loop/op-outcome-held.json +12 -3
- package/src/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
- package/src/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
- package/src/__golden__/wave-loop/op-outcome-replan.json +16 -5
- package/src/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
- package/src/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
- package/src/__golden__/wave-loop/op-overridden.json +28 -7
- package/src/__golden__/wave-loop/op-per-run.json +20 -4
- package/src/__golden__/wave-loop/op-point.json +18 -4
- package/src/__golden__/wave-loop/op-pr-review.json +10 -2
- package/src/__golden__/wave-loop/op-spend-change-only.json +10 -2
- package/src/__golden__/wave-loop/op-spend.json +10 -2
- package/src/__golden__/wave-loop/op-wave-commands.json +56 -13
- package/src/__golden__/wave-loop/op-wide.json +20 -4
- package/src/bucket-check/azure.ts +307 -0
- package/src/bucket-check/bucket-check.test.ts +210 -0
- package/src/bucket-check/fixtures/azure.json +153 -0
- package/src/bucket-check/fixtures/gcs.json +148 -0
- package/src/bucket-check/fixtures/s3.json +277 -0
- package/src/bucket-check/gcs.ts +257 -0
- package/src/bucket-check/index.ts +61 -0
- package/src/bucket-check/s3.ts +433 -0
- package/src/bucket-check/types.ts +75 -0
- package/src/bucket-check/wire.ts +50 -0
- package/src/bucket-check.ts +5 -0
- package/src/capabilities/templates.test.ts +2 -3
- package/src/capabilities/templates.ts +1 -2
- package/src/cdk/advise.test.ts +1 -1
- package/src/change-set-bundle.test.ts +0 -1
- package/src/change-set.ts +2 -3
- package/src/ci-agent.test.ts +348 -0
- package/src/ci-agent.ts +1025 -0
- package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
- package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
- package/src/ci-audit/attribution.ts +260 -0
- package/src/ci-audit/audit-log.ts +220 -0
- package/src/ci-audit/ci-audit.test.ts +175 -0
- package/src/ci-audit/index.ts +15 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +173 -0
- package/src/ci-estate/delivery.ts +433 -0
- package/src/ci-estate/overdue.ts +81 -0
- package/src/ci-estate/page.ts +343 -0
- package/src/ci-estate/rows.ts +251 -0
- package/src/ci-estate.test.ts +281 -0
- package/src/ci-estate.ts +175 -0
- package/src/ci-handover.ts +67 -16
- package/src/ci-identity-database.test.ts +54 -0
- package/src/ci-identity-pulumi.test.ts +163 -0
- package/src/ci-identity-targets.test.ts +3 -1
- package/src/ci-identity.ts +123 -22
- package/src/ci-job-guard.test.ts +154 -0
- package/src/ci-job-guard.ts +319 -0
- package/src/ci-jobs.ts +8 -0
- package/src/ci-product-comment-targets.test.ts +45 -0
- package/src/ci-product-words.test.ts +101 -0
- package/src/ci-product-words.ts +565 -0
- package/src/ci-product.ts +226 -0
- package/src/ci-respond-run.ts +291 -0
- package/src/ci-respond.test.ts +264 -0
- package/src/ci-respond.ts +412 -0
- package/src/ci-shared-reads.test.ts +145 -0
- package/src/cli/commands/audit.test.ts +1 -1
- package/src/cli/commands/audit.ts +3 -2
- package/src/cli/commands/carve.test.ts +1 -1
- package/src/cli/commands/carve.ts +2 -2
- package/src/cli/commands/init.ts +3 -1
- package/src/cli/component-wave-args.test.ts +16 -0
- package/src/cli/handlers/agent.ts +126 -0
- package/src/cli/handlers/approve-confirm.test.ts +276 -0
- package/src/cli/handlers/approve-confirm.ts +200 -0
- package/src/cli/handlers/approve.ts +18 -1
- package/src/cli/handlers/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.test.ts +7 -0
- package/src/cli/handlers/build.ts +113 -1
- package/src/cli/handlers/ci-check-job.test.ts +114 -0
- package/src/cli/handlers/ci-check-job.ts +33 -0
- package/src/cli/handlers/ci-check.ts +63 -0
- package/src/cli/handlers/ci-forge-check.ts +91 -0
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/fan-out.test.ts +10 -10
- package/src/cli/handlers/fan-out.ts +5 -0
- package/src/cli/handlers/gate-pending.ts +46 -0
- package/src/cli/handlers/init.ts +1 -0
- package/src/cli/handlers/ledger.ts +1 -1
- package/src/cli/handlers/lifecycle-drift.ts +7 -2
- package/src/cli/handlers/lock.test.ts +29 -2
- package/src/cli/handlers/lock.ts +66 -6
- package/src/cli/handlers/notify-relay.ts +130 -0
- package/src/cli/handlers/pr-before-merge.test.ts +2 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +7 -7
- package/src/cli/handlers/pr-env.ts +48 -11
- package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr-plan-targets.test.ts +155 -0
- package/src/cli/handlers/pr-waves-blocked.test.ts +5 -0
- package/src/cli/handlers/pr-waves.test.ts +8 -2
- package/src/cli/handlers/pr.test.ts +8 -8
- package/src/cli/handlers/pr.ts +879 -205
- package/src/cli/handlers/promote.test.ts +5 -5
- package/src/cli/handlers/promote.ts +22 -2
- package/src/cli/handlers/release.ts +2 -0
- package/src/cli/handlers/run-components-exit.test.ts +7 -7
- package/src/cli/handlers/run-wave.ts +144 -2
- package/src/cli/handlers/run.test.ts +6 -4
- package/src/cli/handlers/run.ts +86 -1
- package/src/cli/handlers/serve.ts +10 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +180 -13
- package/src/cli/mcp/ledger-tools.ts +126 -0
- package/src/cli/mcp/product-tools.test.ts +123 -0
- package/src/cli/mcp/product-tools.ts +129 -0
- package/src/cli/mcp/read-only.test.ts +134 -0
- package/src/cli/mcp/read-only.ts +68 -0
- package/src/cli/mcp/report-tools.ts +135 -0
- package/src/cli/mcp/server.test.ts +5 -4
- package/src/cli/mcp/server.ts +90 -16
- package/src/cli/mcp-config.ts +8 -3
- package/src/cli/parse-args.ts +119 -2
- package/src/cli/registry.ts +73 -0
- package/src/cloud-lister/sigv4.ts +80 -23
- package/src/components/adoption.test.ts +140 -0
- package/src/components/adoption.ts +140 -0
- package/src/components/apply-lease.ts +49 -0
- package/src/components/capability.ts +180 -6
- package/src/components/check-hooks.test.ts +66 -0
- package/src/components/check-hooks.ts +255 -0
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.test.ts +51 -0
- package/src/components/ci-services.ts +82 -0
- package/src/components/cli-support.ts +23 -2
- package/src/components/driver.test.ts +3 -3
- package/src/components/driver.ts +73 -6
- package/src/components/fan-out-run.ts +68 -18
- package/src/components/groups.ts +21 -4
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -0
- package/src/components/pr-comment-preview.test.ts +54 -0
- package/src/components/pr-env-ledger.test.ts +9 -0
- package/src/components/pr-env-ledger.ts +42 -0
- package/src/components/pr-env-ports.ts +29 -4
- package/src/components/pr-env-run-bundle.test.ts +2 -14
- package/src/components/pr-env-run.test.ts +19 -0
- package/src/components/pr-env-run.ts +12 -2
- package/src/components/pr-environment.test.ts +29 -0
- package/src/components/pr-environment.ts +40 -8
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.test.ts +15 -0
- package/src/components/pr-pipeline.ts +498 -18
- package/src/components/pr-policy.ts +45 -7
- package/src/components/pr-run.test.ts +1 -1
- package/src/components/pr-run.ts +138 -11
- package/src/components/pr-stale-job.test.ts +34 -0
- package/src/components/pr-targets.test.ts +35 -0
- package/src/components/pr-targets.ts +45 -0
- package/src/components/product-pipeline.test.ts +200 -0
- package/src/components/product-pipeline.ts +383 -0
- package/src/components/promote.ts +10 -1
- package/src/components/release-compile.ts +87 -1
- package/src/components/release-promote.ts +65 -1
- package/src/components/repo-lock.ts +52 -0
- package/src/components/row-lease.test.ts +490 -0
- package/src/components/row-lease.ts +167 -0
- package/src/components/wave-plan-policy.test.ts +19 -0
- package/src/components/wave-plan.ts +96 -6
- package/src/control/__fixtures__/consumers/apps/consumers.json +15 -0
- package/src/control/__fixtures__/consumers/infra/consumers.json +23 -0
- package/src/control/applied.test.ts +148 -0
- package/src/control/applied.ts +191 -0
- package/src/control/consumers.test.ts +129 -0
- package/src/control/consumers.ts +192 -0
- package/src/control/control.test.ts +302 -0
- package/src/control/dispatch.ts +699 -0
- package/src/control/edges.test.ts +112 -0
- package/src/control/edges.ts +164 -0
- package/src/control/note-checkout.test.ts +91 -0
- package/src/control/reconcile.ts +250 -0
- package/src/control/records.ts +395 -0
- package/src/discovery/sandbox/bundle.ts +25 -1
- package/src/e2e-harness/__project__/chant.config.ts +4 -0
- package/src/e2e-harness/__project__/src/compose.ts +33 -0
- package/src/e2e-harness/bucket.ts +69 -0
- package/src/e2e-harness/claim.test.ts +150 -0
- package/src/e2e-harness/claim.ts +140 -0
- package/src/e2e-harness/driver.test.ts +304 -0
- package/src/e2e-harness/driver.ts +294 -0
- package/src/e2e-harness/forgejo.ts +267 -0
- package/src/e2e-harness/git.ts +96 -0
- package/src/e2e-harness/index.ts +50 -0
- package/src/e2e-harness/jobs.ts +35 -0
- package/src/e2e-harness/pins.ts +52 -0
- package/src/e2e-harness/ports.ts +130 -0
- package/src/e2e-harness/reports.ts +79 -0
- package/src/e2e-harness/safe-run-cli.test.ts +102 -0
- package/src/e2e-harness/safe-run-cli.ts +54 -0
- package/src/e2e-harness/safe-run.ts +198 -0
- package/src/e2e-harness/scenario.ts +89 -0
- package/src/e2e-harness/schemas/README.md +62 -0
- package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/src/e2e-harness/schemas/index.ts +220 -0
- package/src/e2e-harness/schemas.test.ts +145 -0
- package/src/e2e-harness/stack.test.ts +124 -0
- package/src/e2e-harness/stack.ts +306 -0
- package/src/e2e-harness/steps.ts +30 -0
- package/src/e2e-harness.ts +2 -0
- package/src/engine-facts.test.ts +2 -3
- package/src/engine-facts.ts +1 -2
- package/src/exit-codes.test.ts +32 -0
- package/src/exit-codes.ts +61 -0
- package/src/forge-check/check.ts +155 -0
- package/src/forge-check/contract.ts +215 -0
- package/src/forge-check/forge-check.test.ts +427 -0
- package/src/forge-check/forge.ts +318 -0
- package/src/forge-check/index.ts +43 -0
- package/src/forge-check/pulumi.ts +192 -0
- package/src/forge-check/read-only.ts +56 -0
- package/src/forge-check/trust.ts +527 -0
- package/src/forge-check/types.ts +78 -0
- package/src/forge-check.ts +5 -0
- package/src/gate-decision-bundle.test.ts +11 -0
- package/src/gate-decision.ts +3 -0
- package/src/gate-policy.ts +92 -3
- package/src/gated-waves-bundle.test.ts +0 -1
- package/src/index.ts +2 -0
- package/src/lexicon.ts +143 -6
- package/src/lifecycle/adoption-file.ts +1 -2
- package/src/lifecycle/cloud-index.test.ts +2 -3
- package/src/lifecycle/cloud-index.ts +1 -2
- package/src/lifecycle/control-entries-ledger.test.ts +69 -0
- package/src/lifecycle/gate-applied.ts +6 -0
- package/src/lifecycle/gate-ledger.ts +35 -1
- package/src/lifecycle/gate-pending-by-plan.test.ts +69 -0
- package/src/lifecycle/gate-pending-by-plan.ts +133 -0
- package/src/lifecycle/gated-request-digest.ts +49 -0
- package/src/lifecycle/gated-request-ledger.test.ts +53 -0
- package/src/lifecycle/gated-request.ts +279 -0
- package/src/lifecycle/identity-match.ts +25 -6
- package/src/lifecycle/index-diff.ts +1 -2
- package/src/lifecycle/index-document.ts +1 -2
- package/src/lifecycle/index-import.test.ts +14 -0
- package/src/lifecycle/index-import.ts +54 -34
- package/src/lifecycle/ledger-read.ts +7 -3
- package/src/lifecycle/lock-rows.test.ts +109 -0
- package/src/lifecycle/lock-rows.ts +167 -0
- package/src/lifecycle/publish-target-context.test.ts +108 -0
- package/src/lifecycle/query.test.ts +2 -3
- package/src/lifecycle/query.ts +109 -8
- package/src/lifecycle/release-catalog-site.test.ts +142 -0
- package/src/lifecycle/release-catalog-site.ts +291 -0
- package/src/lifecycle/release-catalog.test.ts +192 -0
- package/src/lifecycle/release-catalog.ts +353 -0
- package/src/lifecycle/release-changelog.test.ts +70 -0
- package/src/lifecycle/release-changelog.ts +71 -0
- package/src/lifecycle/release-cut.ts +2 -2
- package/src/lifecycle/release-ledger.ts +19 -0
- package/src/lifecycle/release-publish.ts +45 -22
- package/src/lifecycle/release-read.ts +2 -0
- package/src/lifecycle/release-status.test.ts +185 -0
- package/src/lifecycle/release-status.ts +175 -0
- package/src/lifecycle/resource-lock.test.ts +175 -0
- package/src/lifecycle/resource-lock.ts +354 -0
- package/src/lifecycle/retention.ts +2 -0
- package/src/lifecycle/run-ledger.ts +7 -1
- package/src/lifecycle/snapshot-store-s3.ts +9 -45
- package/src/lifecycle/snapshot-store.ts +1 -2
- package/src/lifecycle/target-lock.ts +24 -9
- package/src/lifecycle/wave-plans.ts +33 -5
- package/src/mcp/types.ts +7 -0
- package/src/notify-product.ts +76 -0
- package/src/notify-relay.test.ts +213 -0
- package/src/notify-relay.ts +407 -0
- package/src/notify.ts +95 -14
- package/src/object-store/azure-blob.ts +374 -0
- package/src/object-store/common.ts +133 -0
- package/src/object-store/errors.ts +26 -0
- package/src/object-store/from-env.ts +36 -0
- package/src/object-store/gcs.ts +436 -0
- package/src/object-store/index.ts +8 -0
- package/src/object-store/object-store.test.ts +130 -0
- package/src/object-store/s3.ts +350 -0
- package/src/op/activities/converge.ts +2 -1
- package/src/op/activities/index.ts +1 -1
- package/src/op/activities/review-agent.open.test.ts +78 -0
- package/src/op/activities/review-agent.test.ts +13 -0
- package/src/op/activities/review-agent.ts +89 -5
- package/src/op/approval-status.test.ts +134 -0
- package/src/op/approval-status.ts +235 -0
- package/src/op/gate-review.test.ts +2 -1
- package/src/op/gate.ts +81 -22
- package/src/op/generate-pipeline.ts +7 -1
- package/src/op/index.ts +23 -0
- package/src/op/op-waves-after-plan.test.ts +288 -0
- package/src/op/op-waves-after-plan.ts +238 -0
- package/src/op/op-waves-capability-spec.ts +133 -0
- package/src/op/op-waves-capability.test.ts +217 -0
- package/src/op/op-waves-capability.ts +370 -0
- package/src/op/op-waves-events.ts +135 -0
- package/src/op/op-waves-notify-words.test.ts +149 -0
- package/src/op/op-waves-notify.ts +41 -16
- package/src/op/op-waves-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +219 -0
- package/src/op/op-waves-release-port.ts +64 -0
- package/src/op/op-waves-release.test.ts +209 -0
- package/src/op/op-waves-release.ts +132 -0
- package/src/op/op-waves-run-record.test.ts +32 -0
- package/src/op/op-waves-run.ts +1235 -52
- package/src/op/op-waves-stand-down.test.ts +240 -0
- package/src/op/op-waves-stand-down.ts +107 -0
- package/src/op/op-waves-trace.test.ts +205 -0
- package/src/op/op-waves.test.ts +112 -0
- package/src/op/op-waves.ts +320 -22
- package/src/op/runtime.ts +107 -0
- package/src/op/stage-hooks-hold-record.test.ts +41 -0
- package/src/op/stage-hooks.ts +91 -12
- package/src/op/steward-beside.ts +2 -1
- package/src/op/types.ts +3 -2
- package/src/otlp-metrics.ts +96 -0
- package/src/otlp.test.ts +243 -0
- package/src/otlp.ts +543 -0
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/override-gate.ts +4 -0
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-packs.ts +230 -0
- package/src/policy-source.test.ts +256 -0
- package/src/policy-source.ts +111 -0
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +175 -33
- package/src/pr-loop-bundle.test.ts +7 -3
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop-words.test.ts +155 -0
- package/src/pr-loop.ts +398 -52
- package/src/pr-merge.test.ts +100 -0
- package/src/pr-merge.ts +105 -0
- package/src/pr-post-stale.test.ts +163 -0
- package/src/pr-post.ts +190 -5
- package/src/pr-report-url.ts +61 -6
- package/src/pr-requires.test.ts +37 -1
- package/src/pr-requires.ts +16 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +212 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +28 -1
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/sorted-json.ts +17 -0
- package/src/stage-hooks-bundle.test.ts +6 -0
- package/src/terraform/credentials.test.ts +77 -0
- package/src/terraform/credentials.ts +162 -0
- package/src/utils.ts +2 -11
- package/src/wave-loop-golden.test.ts +2 -1
- package/src/wave-runtime.ts +2 -2
- package/src/workspace/chant-migrations/chud-lexicon-exit.ts +4 -1
- package/src/workspace/ci-lock-grain.test.ts +31 -0
- package/src/workspace/ci-lock-grain.ts +29 -0
- package/src/workspace/ci-report-url.test.ts +1 -1
- package/src/workspace/ci-run.test.ts +1 -1
- package/src/workspace/ci-run.ts +10 -3
- package/src/workspace/declaration.schema.json +27 -3
- package/src/workspace/declaration.test.ts +1 -1
- package/src/workspace/declaration.ts +26 -10
- package/src/workspace/drift-cli.ts +8 -3
- package/src/workspace/exit-cli.ts +2 -1
- package/src/workspace/import-fetch.ts +4 -2
- package/src/workspace/import-init.ts +4 -2
- package/src/workspace/ledger.schema.json +7 -3
- package/src/workspace/lineage-upgrade-cli.ts +2 -1
- package/src/workspace/pr-report.schema.json +79 -3
- package/src/workspace/promote.ts +2 -1
- package/src/workspace/records-cli.ts +3 -2
- package/src/workspace/release-catalog.schema.json +277 -0
- package/src/workspace/run-event.schema.json +18 -1
- package/src/workspace/work-cli.ts +8 -2
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apply-job guard (#4624): the expectation a generator writes, each
|
|
3
|
+
* refusal on the three forges, and the `node -e` program giving the same
|
|
4
|
+
* answers as checkJob. Written for the ci-products post-merge pass.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
8
|
+
import { describe, expect, test } from "vitest";
|
|
9
|
+
import { checkJob, describeJobGuard, JOB_GUARD_ENV, JOB_GUARD_JS, jobGuardSpec, jobSeen, opWaveJobLabel, parseJobGuardSpec, type JobGuardSpec } from "./ci-job-guard";
|
|
10
|
+
import { CHANT_EXIT } from "./exit-codes";
|
|
11
|
+
|
|
12
|
+
const jwt = (claims: Record<string, unknown>): string => `h.${Buffer.from(JSON.stringify(claims)).toString("base64url")}.s`;
|
|
13
|
+
|
|
14
|
+
describe("jobGuardSpec", () => {
|
|
15
|
+
test("GitHub reads the environment only in a job that may request a token", () => {
|
|
16
|
+
expect(jobGuardSpec({ forge: "github", job: "j", environment: "prod", branches: ["main"] }).forgeEnvironment).toBeUndefined();
|
|
17
|
+
expect(jobGuardSpec({ forge: "github", job: "j", environment: "prod", branches: ["main"], idToken: true }).forgeEnvironment).toBe("prod");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("GitLab always reads it, and the runner's labels are its tags", () => {
|
|
21
|
+
const s = jobGuardSpec({ forge: "gitlab", job: "j", environment: "prod", branches: ["main"], runner: ["deploy", "eu"] });
|
|
22
|
+
expect(s).toMatchObject({ forgeEnvironment: "prod", runnerTags: ["deploy", "eu"] });
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("Forgejo never reads an environment, and a self-hosted label asks for a self-hosted runner", () => {
|
|
26
|
+
const s = jobGuardSpec({ forge: "forgejo", job: "j", environment: "prod", branches: ["main"], runner: ["self-hosted", "linux"], idToken: true });
|
|
27
|
+
expect(s.forgeEnvironment).toBeUndefined();
|
|
28
|
+
expect(s.selfHosted).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("chant's own product is left out, another is kept", () => {
|
|
32
|
+
expect(jobGuardSpec({ forge: "github", job: "j", product: "chant", branches: ["main"] }).product).toBeUndefined();
|
|
33
|
+
expect(jobGuardSpec({ forge: "github", job: "j", product: "plywood", branches: ["main"] }).product).toBe("plywood");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("checkJob refusals", () => {
|
|
38
|
+
const gh: JobGuardSpec = { forge: "github", job: "wave 1 (prod) of deploy", forgeEnvironment: "prod", branches: ["main"], selfHosted: true };
|
|
39
|
+
const gl: JobGuardSpec = { forge: "gitlab", job: "wave 1 (prod) of deploy", forgeEnvironment: "prod", branches: ["main"], runnerTags: ["deploy"] };
|
|
40
|
+
const fj: JobGuardSpec = { forge: "forgejo", job: "wave 1 (prod) of deploy", branches: ["main"], selfHosted: true };
|
|
41
|
+
|
|
42
|
+
test("GitHub: all match", () => {
|
|
43
|
+
const r = checkJob(gh, { ref: "refs/heads/main", forgeEnvironment: "prod", runnerEnvironment: "self-hosted" });
|
|
44
|
+
expect(r.problems).toEqual([]);
|
|
45
|
+
expect(r.checked).toEqual(["forge environment prod", "ref refs/heads/main", "self-hosted runner"]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("GitHub: another environment, another ref, a hosted runner", () => {
|
|
49
|
+
const r = checkJob(gh, { ref: "refs/heads/feature", forgeEnvironment: "staging", runnerEnvironment: "github-hosted" });
|
|
50
|
+
expect(r.problems).toEqual([
|
|
51
|
+
"forge environment: expected prod, found staging",
|
|
52
|
+
"ref: expected refs/heads/main, found refs/heads/feature",
|
|
53
|
+
"runner: expected self-hosted, found github-hosted",
|
|
54
|
+
]);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("GitHub: no environment, and one that could not be read", () => {
|
|
58
|
+
expect(checkJob(gh, { ref: "refs/heads/main", forgeEnvironment: null }).problems).toEqual(["forge environment: expected prod, found none"]);
|
|
59
|
+
expect(checkJob(gh, { ref: "refs/heads/main", forgeEnvironmentError: "no token" }).problems[0]).toBe("forge environment: expected prod, and it could not be read: no token");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("GitLab: another environment, an unprotected ref, a missing tag", () => {
|
|
63
|
+
const r = checkJob(gl, { ref: "main", refProtected: "false", forgeEnvironment: "dev", runnerTags: ["shared"] });
|
|
64
|
+
expect(r.problems).toEqual([
|
|
65
|
+
"forge environment: expected prod, found dev",
|
|
66
|
+
"ref: expected a protected ref (CI_COMMIT_REF_PROTECTED true), found false",
|
|
67
|
+
"runner: expected tags deploy, found shared",
|
|
68
|
+
]);
|
|
69
|
+
expect(checkJob(gl, { ref: "feature", refProtected: "true", forgeEnvironment: "prod" }).problems).toEqual([
|
|
70
|
+
"ref: expected main, found feature",
|
|
71
|
+
"runner: expected tags deploy, and the job has no CI_RUNNER_TAGS",
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("Forgejo: ref and runner only", () => {
|
|
76
|
+
const r = checkJob(fj, { ref: "refs/heads/dev", runnerEnvironment: "github-hosted" });
|
|
77
|
+
expect(r.skipped).toContain("forge environment (Forgejo has none)");
|
|
78
|
+
expect(r.problems).toEqual(["ref: expected refs/heads/main, found refs/heads/dev", "runner: expected self-hosted, found github-hosted"]);
|
|
79
|
+
expect(checkJob(fj, { ref: "refs/heads/main" }).skipped).toContain("runner (the runner says nothing about itself: no RUNNER_ENVIRONMENT)");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("the refusal names the product and the job, with the reason", () => {
|
|
83
|
+
const spec = { ...gh, product: "plywood" };
|
|
84
|
+
const d = describeJobGuard(spec, checkJob(spec, { ref: "refs/heads/x", forgeEnvironment: "prod", runnerEnvironment: "self-hosted" }));
|
|
85
|
+
expect(d.ok).toBe(false);
|
|
86
|
+
expect(d.err[0]).toBe("plywood check-job: wave 1 (prod) of deploy: ref: expected refs/heads/main, found refs/heads/x");
|
|
87
|
+
expect(d.err.at(-1)).toContain("stops before any credential is taken or code checked out");
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe("jobSeen", () => {
|
|
92
|
+
test("GitHub reads the environment and runner from a token for the guard's own audience", async () => {
|
|
93
|
+
const calls: string[] = [];
|
|
94
|
+
const fetchFn = (async (url: string) => {
|
|
95
|
+
calls.push(url);
|
|
96
|
+
return { ok: true, status: 200, json: async () => ({ value: jwt({ environment: "prod", runner_environment: "self-hosted" }) }) };
|
|
97
|
+
}) as unknown as typeof fetch;
|
|
98
|
+
const seen = await jobSeen({ forge: "github", job: "j", forgeEnvironment: "prod", branches: ["main"] }, { GITHUB_REF: "refs/heads/main", ACTIONS_ID_TOKEN_REQUEST_URL: "https://t?x=1", ACTIONS_ID_TOKEN_REQUEST_TOKEN: "b" }, fetchFn);
|
|
99
|
+
expect(seen).toEqual({ ref: "refs/heads/main", forgeEnvironment: "prod", runnerEnvironment: "self-hosted" });
|
|
100
|
+
expect(calls[0]).toBe("https://t?x=1&audience=chant-check-job");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("GitLab reads its variables", async () => {
|
|
104
|
+
const seen = await jobSeen({ forge: "gitlab", job: "j", branches: ["main"] }, { CI_ENVIRONMENT_NAME: "prod", CI_COMMIT_REF_NAME: "main", CI_COMMIT_REF_PROTECTED: "true", CI_RUNNER_TAGS: '["a","b"]' });
|
|
105
|
+
expect(seen).toEqual({ forgeEnvironment: "prod", ref: "main", refProtected: "true", runnerTags: ["a", "b"] });
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe("parseJobGuardSpec", () => {
|
|
110
|
+
test("refuses a missing or broken variable", () => {
|
|
111
|
+
expect(() => parseJobGuardSpec(undefined)).toThrow(`${JOB_GUARD_ENV} is not set`);
|
|
112
|
+
expect(() => parseJobGuardSpec("{")).toThrow("is not JSON");
|
|
113
|
+
expect(() => parseJobGuardSpec('{"forge":"svn","job":"j","branches":[]}')).toThrow("forge");
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test("opWaveJobLabel", () => {
|
|
118
|
+
expect(opWaveJobLabel("deploy", { kind: "wave", wave: 2, waveName: "prod" })).toBe("wave 2 (prod) of deploy");
|
|
119
|
+
expect(opWaveJobLabel("deploy", { kind: "decide", wave: 2, waveName: "prod" })).toBe("the deciding job of wave 2 (prod) of deploy");
|
|
120
|
+
expect(opWaveJobLabel("deploy", { kind: "share", wave: 2, waveName: "prod", share: 1, group: "eu" })).toBe("share 1 of job group eu of wave 2 (prod) of deploy");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe("the node -e program agrees with checkJob", () => {
|
|
124
|
+
const run = (spec: JobGuardSpec, env: Record<string, string>) =>
|
|
125
|
+
spawnSync(process.execPath, ["-e", JOB_GUARD_JS], { env: { PATH: process.env.PATH ?? "", [JOB_GUARD_ENV]: JSON.stringify(spec), ...env }, encoding: "utf-8" });
|
|
126
|
+
|
|
127
|
+
const cases: Array<[string, JobGuardSpec, Record<string, string>]> = [
|
|
128
|
+
["GitLab match", { forge: "gitlab", job: "w", forgeEnvironment: "prod", branches: ["main"], runnerTags: ["d"] }, { CI_ENVIRONMENT_NAME: "prod", CI_COMMIT_REF_NAME: "main", CI_COMMIT_REF_PROTECTED: "true", CI_RUNNER_TAGS: "d,e" }],
|
|
129
|
+
["GitLab refusal", { forge: "gitlab", job: "w", forgeEnvironment: "prod", branches: ["main"], runnerTags: ["d"] }, { CI_ENVIRONMENT_NAME: "dev", CI_COMMIT_REF_NAME: "x", CI_COMMIT_REF_PROTECTED: "false" }],
|
|
130
|
+
["Forgejo match", { forge: "forgejo", job: "w", branches: ["main"], selfHosted: true }, { GITHUB_REF: "refs/heads/main", RUNNER_ENVIRONMENT: "self-hosted" }],
|
|
131
|
+
["Forgejo refusal", { forge: "forgejo", job: "w", product: "plywood", branches: ["main", "release"], selfHosted: true }, { GITHUB_REF: "refs/heads/dev" }],
|
|
132
|
+
["GitHub without a token to ask for", { forge: "github", job: "w", forgeEnvironment: "prod", branches: ["main"] }, { GITHUB_REF: "refs/heads/main" }],
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
for (const [name, spec, env] of cases) {
|
|
136
|
+
test(name, async () => {
|
|
137
|
+
const r = run(spec, env);
|
|
138
|
+
const want = describeJobGuard(spec, checkJob(spec, await jobSeen(spec, env, (() => Promise.reject(new Error("no fetch"))) as unknown as typeof fetch)));
|
|
139
|
+
expect(r.status).toBe(want.ok ? 0 : CHANT_EXIT.misplaced);
|
|
140
|
+
expect(r.stdout.trim().split("\n").filter(Boolean)).toEqual(want.out);
|
|
141
|
+
expect(r.stderr.trim().split("\n").filter(Boolean)).toEqual(want.err);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
test("a missing variable stops the job", () => {
|
|
146
|
+
const r = spawnSync(process.execPath, ["-e", JOB_GUARD_JS], { env: { PATH: process.env.PATH ?? "" }, encoding: "utf-8" });
|
|
147
|
+
expect(r.status).toBe(CHANT_EXIT.misplaced);
|
|
148
|
+
expect(r.stderr).toContain(`${JOB_GUARD_ENV} is not JSON`);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("the program holds no single quote, so the shell line keeps it whole", () => {
|
|
152
|
+
expect(JOB_GUARD_JS).not.toContain("'");
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apply-job guard (#4624): the first step of each op-wave job checks
|
|
3
|
+
* that the job runs where the spec set it to run, and stops it otherwise,
|
|
4
|
+
* before any token is traded and before the checkout.
|
|
5
|
+
*
|
|
6
|
+
* What the job is expected to see is written into the job when the pipeline
|
|
7
|
+
* is rendered, as JSON in {@link JOB_GUARD_ENV}: the guard reads no file of
|
|
8
|
+
* the commit it runs on. What it sees comes from the forge:
|
|
9
|
+
*
|
|
10
|
+
* forge environment GitHub: the `environment` claim of an OIDC token the
|
|
11
|
+
* guard requests for its own audience
|
|
12
|
+
* ({@link JOB_GUARD_AUDIENCE}), decodes and drops. GitHub
|
|
13
|
+
* sets no variable with the job's environment, so a job
|
|
14
|
+
* that may request no token is not checked for it.
|
|
15
|
+
* GitLab: CI_ENVIRONMENT_NAME. Forgejo has no
|
|
16
|
+
* environments: not checked.
|
|
17
|
+
* ref GitHub and Forgejo: GITHUB_REF is refs/heads/<branch>
|
|
18
|
+
* for one of the branches the waves apply from. GitLab:
|
|
19
|
+
* CI_COMMIT_REF_NAME is one of them, and
|
|
20
|
+
* CI_COMMIT_REF_PROTECTED is "true".
|
|
21
|
+
* runner GitLab: CI_RUNNER_TAGS holds each of the job's tags.
|
|
22
|
+
* GitHub and Forgejo expose no labels, only whether the
|
|
23
|
+
* runner is self-hosted: when the job's labels include
|
|
24
|
+
* `self-hosted`, the token's runner_environment claim,
|
|
25
|
+
* else RUNNER_ENVIRONMENT, is `self-hosted`. Neither
|
|
26
|
+
* set: not checked.
|
|
27
|
+
*
|
|
28
|
+
* The generated step runs {@link jobGuardLine}: `node -e` from `/`, as the
|
|
29
|
+
* cloud trade does, so no file of the checkout is in reach and the guard
|
|
30
|
+
* needs nothing installed. `chant ci check-job` (and so a product's bin,
|
|
31
|
+
* `plywood ci check-job`, `terragucci ci check-job`) runs the same check
|
|
32
|
+
* from the same variable, through {@link checkJob}, for a product that
|
|
33
|
+
* renders its own jobs. The lines name the product from its words.
|
|
34
|
+
*
|
|
35
|
+
* A refusal exits chant's `misplaced` (9), as does a variable the guard
|
|
36
|
+
* cannot read. GitLab's op-wave jobs allow exit 1 as a failure the next wave
|
|
37
|
+
* runs after, and 9 is outside that set, so a refused job fails and the
|
|
38
|
+
* waves after it stop.
|
|
39
|
+
*
|
|
40
|
+
* The guard catches a hand edit, a dropped `environment:` or a mistyped
|
|
41
|
+
* label. Someone who can edit the workflow can delete it too: the forge's
|
|
42
|
+
* environment and runner settings and the cloud role's trust are what keep
|
|
43
|
+
* a job out.
|
|
44
|
+
*/
|
|
45
|
+
import { isRunnerGroup, type CiRunner } from "./ci-jobs";
|
|
46
|
+
import { CHANT_EXIT } from "./exit-codes";
|
|
47
|
+
|
|
48
|
+
/** The variable the generated step carries its expectation in. */
|
|
49
|
+
export const JOB_GUARD_ENV = "CHANT_JOB_GUARD";
|
|
50
|
+
|
|
51
|
+
/** The audience of the token the guard requests on GitHub, which no cloud role should trust. */
|
|
52
|
+
export const JOB_GUARD_AUDIENCE = "chant-check-job";
|
|
53
|
+
|
|
54
|
+
export type JobGuardForge = "github" | "gitlab" | "forgejo";
|
|
55
|
+
|
|
56
|
+
/** Where a job is expected to run, as the step carries it. */
|
|
57
|
+
export interface JobGuardSpec {
|
|
58
|
+
forge: JobGuardForge;
|
|
59
|
+
/** The job, as the lines name it: `wave 2 (prod) of deploy`. */
|
|
60
|
+
job: string;
|
|
61
|
+
/** The product the lines speak for (`chant`, `plywood`). Default `chant`. */
|
|
62
|
+
product?: string;
|
|
63
|
+
/** The forge environment the job runs in. Unset: not checked. */
|
|
64
|
+
forgeEnvironment?: string;
|
|
65
|
+
/** The branches the job may run from. */
|
|
66
|
+
branches: string[];
|
|
67
|
+
/** GitLab: the tags the job's runner must carry. */
|
|
68
|
+
runnerTags?: string[];
|
|
69
|
+
/** GitHub and Forgejo: the runner must be self-hosted. */
|
|
70
|
+
selfHosted?: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** What the job sees. Undefined: the forge did not say. */
|
|
74
|
+
export interface JobSeen {
|
|
75
|
+
/** The job's forge environment; null when the job runs in none. */
|
|
76
|
+
forgeEnvironment?: string | null;
|
|
77
|
+
/** Why the forge environment could not be read, when it could not. */
|
|
78
|
+
forgeEnvironmentError?: string;
|
|
79
|
+
ref?: string;
|
|
80
|
+
refProtected?: string;
|
|
81
|
+
runnerTags?: string[];
|
|
82
|
+
runnerEnvironment?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface JobGuardResult {
|
|
86
|
+
/** One line per value that does not match, naming the expected and found values. */
|
|
87
|
+
problems: string[];
|
|
88
|
+
/** What was checked and matched. */
|
|
89
|
+
checked: string[];
|
|
90
|
+
/** What the forge does not expose, so was not checked. */
|
|
91
|
+
skipped: string[];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** What a generator knows about one job. */
|
|
95
|
+
export interface JobGuardInput {
|
|
96
|
+
forge: JobGuardForge;
|
|
97
|
+
job: string;
|
|
98
|
+
product?: string;
|
|
99
|
+
/** The forge environment's name, when the job has one. */
|
|
100
|
+
environment?: string;
|
|
101
|
+
/** The branches the job runs from. */
|
|
102
|
+
branches: readonly string[];
|
|
103
|
+
/** The job's runner, as the spec gives it. */
|
|
104
|
+
runner?: CiRunner;
|
|
105
|
+
/** GitHub: the job may request an OIDC token (`id-token: write`), so the guard can read its environment. */
|
|
106
|
+
idToken?: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The expectation a generator writes into a job. GitHub checks the forge
|
|
111
|
+
* environment only in a job that may request a token; Forgejo never does.
|
|
112
|
+
*/
|
|
113
|
+
export function jobGuardSpec(input: JobGuardInput): JobGuardSpec {
|
|
114
|
+
const labels = input.runner === undefined ? [] : typeof input.runner === "string" ? [input.runner] : isRunnerGroup(input.runner) ? [...(input.runner.labels ?? [])] : [...input.runner];
|
|
115
|
+
const readsEnvironment = input.forge === "gitlab" || (input.forge === "github" && input.idToken === true);
|
|
116
|
+
return {
|
|
117
|
+
forge: input.forge,
|
|
118
|
+
job: input.job,
|
|
119
|
+
...(input.product && input.product !== "chant" ? { product: input.product } : {}),
|
|
120
|
+
...(input.environment !== undefined && readsEnvironment ? { forgeEnvironment: input.environment } : {}),
|
|
121
|
+
branches: [...input.branches],
|
|
122
|
+
...(input.forge === "gitlab" && labels.length > 0 ? { runnerTags: labels } : {}),
|
|
123
|
+
...(input.forge !== "gitlab" && labels.includes("self-hosted") ? { selfHosted: true } : {}),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Read {@link JOB_GUARD_ENV}'s JSON, refusing one that is not a guard spec. */
|
|
128
|
+
export function parseJobGuardSpec(raw: string | undefined): JobGuardSpec {
|
|
129
|
+
if (raw === undefined || raw.trim() === "") throw new Error(`${JOB_GUARD_ENV} is not set; the generated step carries the job's expectation in it`);
|
|
130
|
+
let v: unknown;
|
|
131
|
+
try {
|
|
132
|
+
v = JSON.parse(raw);
|
|
133
|
+
} catch {
|
|
134
|
+
throw new Error(`${JOB_GUARD_ENV} is not JSON`);
|
|
135
|
+
}
|
|
136
|
+
const o = v as Partial<JobGuardSpec> | null;
|
|
137
|
+
if (!o || typeof o !== "object") throw new Error(`${JOB_GUARD_ENV} is not an object`);
|
|
138
|
+
if (o.forge !== "github" && o.forge !== "gitlab" && o.forge !== "forgejo") throw new Error(`${JOB_GUARD_ENV}.forge is ${JSON.stringify(o.forge)}; give github, gitlab or forgejo`);
|
|
139
|
+
if (typeof o.job !== "string" || o.job === "") throw new Error(`${JOB_GUARD_ENV}.job names no job`);
|
|
140
|
+
if (!Array.isArray(o.branches) || o.branches.some((b) => typeof b !== "string")) throw new Error(`${JOB_GUARD_ENV}.branches is not a list of branches`);
|
|
141
|
+
if (o.forgeEnvironment !== undefined && typeof o.forgeEnvironment !== "string") throw new Error(`${JOB_GUARD_ENV}.forgeEnvironment is not a name`);
|
|
142
|
+
if (o.runnerTags !== undefined && (!Array.isArray(o.runnerTags) || o.runnerTags.some((t) => typeof t !== "string"))) throw new Error(`${JOB_GUARD_ENV}.runnerTags is not a list of tags`);
|
|
143
|
+
return o as JobGuardSpec;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const shown = (v: string | null | undefined): string => (v === undefined || v === null || v === "" ? "none" : v);
|
|
147
|
+
|
|
148
|
+
/** The tags CI_RUNNER_TAGS lists: a JSON array, or a comma-separated list. */
|
|
149
|
+
export function runnerTagsOf(raw: string | undefined): string[] | undefined {
|
|
150
|
+
if (raw === undefined) return undefined;
|
|
151
|
+
const t = raw.trim();
|
|
152
|
+
if (t.startsWith("[")) {
|
|
153
|
+
try {
|
|
154
|
+
const v = JSON.parse(t) as unknown;
|
|
155
|
+
if (Array.isArray(v)) return v.map(String);
|
|
156
|
+
} catch {
|
|
157
|
+
// fall through to the plain list
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return t === "" ? [] : t.split(",").map((s) => s.trim()).filter((s) => s !== "");
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A JWT's claims, without checking its signature: the token came from the forge a moment ago and is used for nothing else. */
|
|
164
|
+
export function tokenClaims(token: string): Record<string, unknown> {
|
|
165
|
+
const part = token.split(".")[1];
|
|
166
|
+
if (!part) throw new Error("the forge's OIDC token is not a JWT");
|
|
167
|
+
const json = Buffer.from(part.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf-8");
|
|
168
|
+
const claims = JSON.parse(json) as unknown;
|
|
169
|
+
if (!claims || typeof claims !== "object") throw new Error("the forge's OIDC token has no claims");
|
|
170
|
+
return claims as Record<string, unknown>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Compare what the job sees with what the spec expects. */
|
|
174
|
+
export function checkJob(expect: JobGuardSpec, seen: JobSeen): JobGuardResult {
|
|
175
|
+
const out: JobGuardResult = { problems: [], checked: [], skipped: [] };
|
|
176
|
+
const fe = expect.forgeEnvironment;
|
|
177
|
+
if (expect.forge === "forgejo") out.skipped.push("forge environment (Forgejo has none)");
|
|
178
|
+
else if (fe !== undefined) {
|
|
179
|
+
if (seen.forgeEnvironmentError !== undefined) out.problems.push(`forge environment: expected ${fe}, and it could not be read: ${seen.forgeEnvironmentError}`);
|
|
180
|
+
else if (seen.forgeEnvironment !== fe) out.problems.push(`forge environment: expected ${fe}, found ${shown(seen.forgeEnvironment)}`);
|
|
181
|
+
else out.checked.push(`forge environment ${fe}`);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const branches = expect.branches.filter((b) => b !== "");
|
|
185
|
+
if (branches.length === 0) out.problems.push("ref: the job names no branch to run from");
|
|
186
|
+
else if (expect.forge === "gitlab") {
|
|
187
|
+
if (!seen.ref || !branches.includes(seen.ref)) out.problems.push(`ref: expected ${branches.join(" or ")}, found ${shown(seen.ref)}`);
|
|
188
|
+
else out.checked.push(`ref ${seen.ref}`);
|
|
189
|
+
if (seen.refProtected !== "true") out.problems.push(`ref: expected a protected ref (CI_COMMIT_REF_PROTECTED true), found ${shown(seen.refProtected)}`);
|
|
190
|
+
else out.checked.push("protected ref");
|
|
191
|
+
} else {
|
|
192
|
+
const refs = branches.map((b) => `refs/heads/${b}`);
|
|
193
|
+
if (!seen.ref || !refs.includes(seen.ref)) out.problems.push(`ref: expected ${refs.join(" or ")}, found ${shown(seen.ref)}`);
|
|
194
|
+
else out.checked.push(`ref ${seen.ref}`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (expect.forge === "gitlab") {
|
|
198
|
+
const want = expect.runnerTags ?? [];
|
|
199
|
+
if (want.length > 0) {
|
|
200
|
+
const have = seen.runnerTags;
|
|
201
|
+
const missing = want.filter((t) => !(have ?? []).includes(t));
|
|
202
|
+
if (have === undefined) out.problems.push(`runner: expected tags ${want.join(", ")}, and the job has no CI_RUNNER_TAGS`);
|
|
203
|
+
else if (missing.length > 0) out.problems.push(`runner: expected tags ${want.join(", ")}, found ${have.length ? have.join(", ") : "none"}`);
|
|
204
|
+
else out.checked.push(`runner tags ${want.join(", ")}`);
|
|
205
|
+
}
|
|
206
|
+
} else if (expect.selfHosted) {
|
|
207
|
+
if (seen.runnerEnvironment === undefined) out.skipped.push("runner (the runner says nothing about itself: no RUNNER_ENVIRONMENT)");
|
|
208
|
+
else if (seen.runnerEnvironment !== "self-hosted") out.problems.push(`runner: expected self-hosted, found ${seen.runnerEnvironment}`);
|
|
209
|
+
else out.checked.push("self-hosted runner");
|
|
210
|
+
}
|
|
211
|
+
return out;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Ask GitHub for an OIDC token for {@link JOB_GUARD_AUDIENCE} and return its claims; the token itself is dropped. */
|
|
215
|
+
async function githubClaims(env: NodeJS.ProcessEnv, fetchFn: typeof fetch): Promise<Record<string, unknown>> {
|
|
216
|
+
const url = env.ACTIONS_ID_TOKEN_REQUEST_URL;
|
|
217
|
+
const bearer = env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
|
|
218
|
+
if (!url || !bearer) throw new Error("the job may request no OIDC token (no ACTIONS_ID_TOKEN_REQUEST_URL); it needs the id-token: write permission");
|
|
219
|
+
const r = await fetchFn(`${url}&audience=${encodeURIComponent(JOB_GUARD_AUDIENCE)}`, { headers: { authorization: `bearer ${bearer}` } });
|
|
220
|
+
if (!r.ok) throw new Error(`the OIDC token request answered ${r.status}`);
|
|
221
|
+
const value = ((await r.json()) as { value?: unknown }).value;
|
|
222
|
+
if (typeof value !== "string") throw new Error("the OIDC token request answered no token");
|
|
223
|
+
return tokenClaims(value);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** What the job sees, from the forge's variables, and on GitHub from its token's claims when the forge environment is to be checked. */
|
|
227
|
+
export async function jobSeen(expect: JobGuardSpec, env: NodeJS.ProcessEnv = process.env, fetchFn: typeof fetch = fetch): Promise<JobSeen> {
|
|
228
|
+
if (expect.forge === "gitlab") {
|
|
229
|
+
return {
|
|
230
|
+
forgeEnvironment: env.CI_ENVIRONMENT_NAME || null,
|
|
231
|
+
...(env.CI_COMMIT_REF_NAME !== undefined ? { ref: env.CI_COMMIT_REF_NAME } : {}),
|
|
232
|
+
...(env.CI_COMMIT_REF_PROTECTED !== undefined ? { refProtected: env.CI_COMMIT_REF_PROTECTED } : {}),
|
|
233
|
+
...(env.CI_RUNNER_TAGS !== undefined ? { runnerTags: runnerTagsOf(env.CI_RUNNER_TAGS) } : {}),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const seen: JobSeen = { ...(env.GITHUB_REF !== undefined ? { ref: env.GITHUB_REF } : {}) };
|
|
237
|
+
let claims: Record<string, unknown> | undefined;
|
|
238
|
+
if (expect.forge === "github" && expect.forgeEnvironment !== undefined) {
|
|
239
|
+
try {
|
|
240
|
+
claims = await githubClaims(env, fetchFn);
|
|
241
|
+
seen.forgeEnvironment = typeof claims.environment === "string" && claims.environment !== "" ? claims.environment : null;
|
|
242
|
+
} catch (e) {
|
|
243
|
+
seen.forgeEnvironmentError = (e as Error).message;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const runner = typeof claims?.runner_environment === "string" ? claims.runner_environment : env.RUNNER_ENVIRONMENT;
|
|
247
|
+
if (runner) seen.runnerEnvironment = runner;
|
|
248
|
+
return seen;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The lines the guard prints, and whether the job may go on. */
|
|
252
|
+
export function describeJobGuard(expect: JobGuardSpec, result: JobGuardResult): { ok: boolean; out: string[]; err: string[] } {
|
|
253
|
+
const at = `${expect.product ?? "chant"} check-job: ${expect.job}`;
|
|
254
|
+
if (result.problems.length > 0) {
|
|
255
|
+
return {
|
|
256
|
+
ok: false,
|
|
257
|
+
out: [],
|
|
258
|
+
err: [...result.problems.map((p) => `${at}: ${p}`), `${at}: this job does not run where the spec set it to run, so it stops before any credential is taken or code checked out`],
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const skipped = result.skipped.length ? `; not checked: ${result.skipped.join(", ")}` : "";
|
|
262
|
+
return { ok: true, out: [`${at}: ${result.checked.length ? result.checked.join(", ") : "nothing to check"}${skipped}`], err: [] };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The guard as one `node -e` program: the same checks as {@link checkJob},
|
|
267
|
+
* {@link jobSeen} and {@link describeJobGuard}, reading {@link JOB_GUARD_ENV}.
|
|
268
|
+
* Exits chant's `misplaced` (9) with one line per value that differs, and
|
|
269
|
+
* when the variable holds no spec it can read. A test runs it against
|
|
270
|
+
* {@link checkJob} so the two stay the same.
|
|
271
|
+
*/
|
|
272
|
+
export const JOB_GUARD_JS = [
|
|
273
|
+
'"use strict";',
|
|
274
|
+
`const E=process.env,A=${JSON.stringify(JOB_GUARD_AUDIENCE)};`,
|
|
275
|
+
"const shown=(v)=>v===undefined||v===null||v===\"\"?\"none\":v;",
|
|
276
|
+
`const fail=(m)=>{console.error("check-job: "+m);process.exit(${CHANT_EXIT.misplaced})};`,
|
|
277
|
+
"let x;try{x=JSON.parse(E." + JOB_GUARD_ENV + "||\"\")}catch(e){fail(\"" + JOB_GUARD_ENV + " is not JSON\")}",
|
|
278
|
+
"if(!x||![\"github\",\"gitlab\",\"forgejo\"].includes(x.forge)||!Array.isArray(x.branches))fail(\"" + JOB_GUARD_ENV + " is not a guard spec\");",
|
|
279
|
+
'const tags=(r)=>{if(r===undefined)return undefined;const t=r.trim();if(t.startsWith("[")){try{const v=JSON.parse(t);if(Array.isArray(v))return v.map(String)}catch(e){}}return t===""?[]:t.split(",").map((s)=>s.trim()).filter((s)=>s!=="")};',
|
|
280
|
+
'const claimsOf=(tok)=>{const p=tok.split(".")[1];if(!p)throw new Error("the forge\\u0027s OIDC token is not a JWT");const c=JSON.parse(Buffer.from(p.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf-8"));if(!c||typeof c!=="object")throw new Error("the forge\\u0027s OIDC token has no claims");return c};',
|
|
281
|
+
"async function seenOf(){",
|
|
282
|
+
'if(x.forge==="gitlab")return{forgeEnvironment:E.CI_ENVIRONMENT_NAME||null,ref:E.CI_COMMIT_REF_NAME,refProtected:E.CI_COMMIT_REF_PROTECTED,runnerTags:tags(E.CI_RUNNER_TAGS)};',
|
|
283
|
+
"const s={ref:E.GITHUB_REF};let c;",
|
|
284
|
+
'if(x.forge==="github"&&x.forgeEnvironment!==undefined){try{',
|
|
285
|
+
'if(!E.ACTIONS_ID_TOKEN_REQUEST_URL||!E.ACTIONS_ID_TOKEN_REQUEST_TOKEN)throw new Error("the job may request no OIDC token (no ACTIONS_ID_TOKEN_REQUEST_URL); it needs the id-token: write permission");',
|
|
286
|
+
'const r=await fetch(E.ACTIONS_ID_TOKEN_REQUEST_URL+"&audience="+encodeURIComponent(A),{headers:{authorization:"bearer "+E.ACTIONS_ID_TOKEN_REQUEST_TOKEN}});',
|
|
287
|
+
'if(!r.ok)throw new Error("the OIDC token request answered "+r.status);const v=(await r.json()).value;if(typeof v!=="string")throw new Error("the OIDC token request answered no token");',
|
|
288
|
+
'c=claimsOf(v);s.forgeEnvironment=typeof c.environment==="string"&&c.environment!==""?c.environment:null}catch(e){s.forgeEnvironmentError=e&&e.message?e.message:String(e)}}',
|
|
289
|
+
'const run=c&&typeof c.runner_environment==="string"?c.runner_environment:E.RUNNER_ENVIRONMENT;if(run)s.runnerEnvironment=run;return s}',
|
|
290
|
+
"seenOf().then((s)=>{const P=[],C=[],S=[];const fe=x.forgeEnvironment;",
|
|
291
|
+
'if(x.forge==="forgejo")S.push("forge environment (Forgejo has none)");',
|
|
292
|
+
'else if(fe!==undefined){if(s.forgeEnvironmentError!==undefined)P.push("forge environment: expected "+fe+", and it could not be read: "+s.forgeEnvironmentError);else if(s.forgeEnvironment!==fe)P.push("forge environment: expected "+fe+", found "+shown(s.forgeEnvironment));else C.push("forge environment "+fe)}',
|
|
293
|
+
'const b=x.branches.filter((v)=>v!=="");',
|
|
294
|
+
'if(b.length===0)P.push("ref: the job names no branch to run from");',
|
|
295
|
+
'else if(x.forge==="gitlab"){if(!s.ref||!b.includes(s.ref))P.push("ref: expected "+b.join(" or ")+", found "+shown(s.ref));else C.push("ref "+s.ref);',
|
|
296
|
+
'if(s.refProtected!=="true")P.push("ref: expected a protected ref (CI_COMMIT_REF_PROTECTED true), found "+shown(s.refProtected));else C.push("protected ref")}',
|
|
297
|
+
'else{const refs=b.map((v)=>"refs/heads/"+v);if(!s.ref||!refs.includes(s.ref))P.push("ref: expected "+refs.join(" or ")+", found "+shown(s.ref));else C.push("ref "+s.ref)}',
|
|
298
|
+
'if(x.forge==="gitlab"){const w=x.runnerTags||[];if(w.length>0){const h=s.runnerTags;const miss=w.filter((t)=>!(h||[]).includes(t));',
|
|
299
|
+
'if(h===undefined)P.push("runner: expected tags "+w.join(", ")+", and the job has no CI_RUNNER_TAGS");else if(miss.length>0)P.push("runner: expected tags "+w.join(", ")+", found "+(h.length?h.join(", "):"none"));else C.push("runner tags "+w.join(", "))}}',
|
|
300
|
+
'else if(x.selfHosted){if(s.runnerEnvironment===undefined)S.push("runner (the runner says nothing about itself: no RUNNER_ENVIRONMENT)");else if(s.runnerEnvironment!=="self-hosted")P.push("runner: expected self-hosted, found "+s.runnerEnvironment);else C.push("self-hosted runner")}',
|
|
301
|
+
'const at=(x.product||"chant")+" check-job: "+x.job;',
|
|
302
|
+
'if(P.length>0){for(const p of P)console.error(at+": "+p);console.error(at+": this job does not run where the spec set it to run, so it stops before any credential is taken or code checked out");process.exit(' + CHANT_EXIT.misplaced + ")}",
|
|
303
|
+
'console.log(at+": "+(C.length?C.join(", "):"nothing to check")+(S.length?"; not checked: "+S.join(", "):""))',
|
|
304
|
+
"}).catch((e)=>fail(e&&e.message?e.message:String(e)));",
|
|
305
|
+
].join("");
|
|
306
|
+
|
|
307
|
+
/** The shell line of the guard step: `node -e` from `/`, so no file of the checkout is in reach. */
|
|
308
|
+
export function jobGuardLine(): string {
|
|
309
|
+
return `(cd / && node -e '${JOB_GUARD_JS}')`;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** How the guard's lines name an op-wave job: `wave 2 (prod) of deploy`, `share 1 of job group eu of wave 2 (prod) of deploy`. */
|
|
313
|
+
export function opWaveJobLabel(spec: string, job: { kind: "wave" | "decide" | "share"; wave: number; waveName: string; share?: number; group?: string }): string {
|
|
314
|
+
const wave = `wave ${job.wave} (${job.waveName}) of ${spec}`;
|
|
315
|
+
const share = job.share !== undefined ? `share ${job.share} of ` : "";
|
|
316
|
+
if (job.kind === "decide") return `the deciding job of ${wave}`;
|
|
317
|
+
if (job.group !== undefined) return `${share}job group ${job.group} of ${wave}`;
|
|
318
|
+
return `${share}${wave}`;
|
|
319
|
+
}
|
package/src/ci-jobs.ts
CHANGED
|
@@ -43,6 +43,14 @@ export const CI_IMAGE = "node:22";
|
|
|
43
43
|
*/
|
|
44
44
|
export const DEFAULT_BRANCH = "main";
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Where the pull request environment jobs (#4298) write their reports, kept
|
|
48
|
+
* as a CI artifact. It lives here, with no imports, so `pr-env` code that
|
|
49
|
+
* needs only the path (./components/pr-environment.ts and the pr-env-run
|
|
50
|
+
* bundle) does not load ./components/pr-pipeline.ts.
|
|
51
|
+
*/
|
|
52
|
+
export const PR_ENV_REPORT_DIR = ".chant/pr-env";
|
|
53
|
+
|
|
46
54
|
/**
|
|
47
55
|
* The branches a push trigger filters on: the ones given, or
|
|
48
56
|
* {@link DEFAULT_BRANCH} when none are. An empty list is none, on every
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--target` in the product's plan comment (#4626): repeatable, a bare
|
|
3
|
+
* address or `<member>:<address>`, beside at most one member, and refused
|
|
4
|
+
* when it carries spaces or shell characters. Written for the ci-products
|
|
5
|
+
* post-merge pass.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, expect, test } from "vitest";
|
|
8
|
+
import { assertProductWords, parseProductComment } from "./ci-product-words";
|
|
9
|
+
import { PLYWOOD } from "./__fixtures__/product-words";
|
|
10
|
+
|
|
11
|
+
const pw = assertProductWords(PLYWOOD);
|
|
12
|
+
const URN = "urn:pulumi:dev::shop::aws:s3/bucket:Bucket::site";
|
|
13
|
+
|
|
14
|
+
describe("--target in the plan comment (#4626)", () => {
|
|
15
|
+
test("reads each --target after the plan word", () => {
|
|
16
|
+
expect(parseProductComment(pw, `/plywood preview --target ${URN}`)).toEqual({ kind: "plan", targets: [URN] });
|
|
17
|
+
expect(parseProductComment(pw, `/plywood preview --target shop:${URN} --target 'x'`.replace(" --target 'x'", ""))).toEqual({ kind: "plan", targets: [`shop:${URN}`] });
|
|
18
|
+
expect(parseProductComment(pw, `/plywood preview shop-dev --target a --target b`)).toEqual({ kind: "plan", member: "shop-dev", targets: ["a", "b"] });
|
|
19
|
+
expect(parseProductComment(pw, `/plywood preview --target module.net.aws_vpc.main["eu"]`)).toEqual({ kind: "plan", targets: ['module.net.aws_vpc.main["eu"]'] });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("a plain plan comment is unchanged", () => {
|
|
23
|
+
expect(parseProductComment(pw, "/plywood preview")).toEqual({ kind: "plan" });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("refuses a missing address, another flag, shell characters and two members", () => {
|
|
27
|
+
expect(parseProductComment(pw, "/plywood preview --target")).toMatchObject({ kind: "refused", reason: expect.stringMatching(/needs an address/) });
|
|
28
|
+
expect(parseProductComment(pw, "/plywood preview --diff")).toMatchObject({ kind: "refused", reason: expect.stringMatching(/no other flag/) });
|
|
29
|
+
for (const bad of ["a;b", "a`b`", "$(x)", "a|b", "a&b", "'a'", "-a"]) {
|
|
30
|
+
expect(parseProductComment(pw, `/plywood preview --target ${bad}`), bad).toMatchObject({ kind: "refused" });
|
|
31
|
+
}
|
|
32
|
+
expect(parseProductComment(pw, "/plywood preview one two --target a")).toMatchObject({ kind: "refused", reason: expect.stringMatching(/one stack at most/) });
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe("--refresh and --target-dependents in the plan comment (#4627)", () => {
|
|
37
|
+
test("read beside the targets", () => {
|
|
38
|
+
expect(parseProductComment(pw, "/plywood preview --refresh")).toEqual({ kind: "plan", refresh: true });
|
|
39
|
+
expect(parseProductComment(pw, "/plywood preview --target a --target-dependents --refresh")).toEqual({ kind: "plan", targets: ["a"], targetDependents: true, refresh: true });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("--target-dependents needs a target", () => {
|
|
43
|
+
expect(parseProductComment(pw, "/plywood preview --target-dependents")).toMatchObject({ kind: "refused", reason: expect.stringMatching(/widens a `--target`/) });
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
activeProductWords,
|
|
4
|
+
approveLine,
|
|
5
|
+
assertProductWords,
|
|
6
|
+
CHANT_WORDS,
|
|
7
|
+
commentLine,
|
|
8
|
+
overrideLine,
|
|
9
|
+
parseProductComment,
|
|
10
|
+
productStatusContext,
|
|
11
|
+
productWordsProblems,
|
|
12
|
+
resolveProductWords,
|
|
13
|
+
setActiveProductWords,
|
|
14
|
+
withProductWords,
|
|
15
|
+
} from "./ci-product-words";
|
|
16
|
+
import { PLYWOOD, TERRAGUCCI, YODEL } from "./__fixtures__/product-words";
|
|
17
|
+
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
setActiveProductWords(undefined);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("a CI product's words (#4550)", () => {
|
|
23
|
+
test("every slot defaults to chant's word", () => {
|
|
24
|
+
expect(resolveProductWords({})).toEqual(CHANT_WORDS);
|
|
25
|
+
expect(productStatusContext(CHANT_WORDS, "plan")).toBe("chant/plan");
|
|
26
|
+
expect(commentLine(CHANT_WORDS, "apply")).toBe("/chant apply");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("a product's status contexts, comments and approve lines are its own", () => {
|
|
30
|
+
const w = assertProductWords(PLYWOOD);
|
|
31
|
+
expect(productStatusContext(w, "plan")).toBe("plywood/preview");
|
|
32
|
+
expect(productStatusContext(w, "plan", "shop-dev")).toBe("plywood/preview/shop-dev");
|
|
33
|
+
expect(commentLine(w, "apply")).toBe("/plywood up");
|
|
34
|
+
expect(approveLine(w, { op: "pulumi-up", gate: "wave-2", digest: "sha256:abc" })).toBe("plywood approve wave-2 --plan sha256:abc --sign");
|
|
35
|
+
expect(overrideLine(w, { op: "policy-override", gate: "up", rules: ["b", "a"] })).toBe("plywood override up --rule a --rule b --reason <text>");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("the approve and override templates take {target} (#4574)", () => {
|
|
39
|
+
const yodel = assertProductWords({ product: "yodel", approve: "yodel approve {target} --plan {digest}", override: "yodel override {target} --rule {rule} --reason {reason}" });
|
|
40
|
+
expect(approveLine(yodel, { op: "migrate", gate: "wave-1", digest: "sha256:abc", target: "prod/acme" })).toBe("yodel approve prod/acme --plan sha256:abc");
|
|
41
|
+
expect(overrideLine(yodel, { op: "policy-override", rules: ["no-drop"], target: "prod/acme", reason: "planned" })).toBe("yodel override prod/acme --rule no-drop --reason planned");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("the apply mode follows the words: waves on merge for a product with an op or per-wave approvals, else a release (#4601)", () => {
|
|
45
|
+
expect(CHANT_WORDS.applyMode).toBe("release");
|
|
46
|
+
expect(assertProductWords(PLYWOOD).applyMode).toBe("on-merge");
|
|
47
|
+
expect(assertProductWords(TERRAGUCCI).applyMode).toBe("on-merge");
|
|
48
|
+
expect(assertProductWords(YODEL).applyMode).toBe("on-merge");
|
|
49
|
+
expect(assertProductWords({ product: "acme" }).applyMode).toBe("release");
|
|
50
|
+
expect(assertProductWords({ ...PLYWOOD, applyMode: "before-merge" }).applyMode).toBe("before-merge");
|
|
51
|
+
expect(productWordsProblems(resolveProductWords({ applyMode: "later" as never })).some((p) => /applyMode is "later"/.test(p))).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("words that could reach a shell or collide are refused", () => {
|
|
55
|
+
const bad = resolveProductWords({ product: "Ply wood", stages: { plan: "apply" }, commands: { "$(x)": "apply", go: "deploy" as never }, approve: "x {op} {who}; rm" });
|
|
56
|
+
const problems = productWordsProblems(bad, { jobs: ["plan"] });
|
|
57
|
+
expect(problems.some((p) => /product is "Ply wood"/.test(p))).toBe(true);
|
|
58
|
+
expect(problems.some((p) => /stages.apply and stages.plan are both "apply"/.test(p))).toBe(true);
|
|
59
|
+
expect(problems.some((p) => /commands.\$\(x\)/.test(p))).toBe(true);
|
|
60
|
+
expect(problems.some((p) => /needs a apply job/.test(p))).toBe(true);
|
|
61
|
+
expect(problems.some((p) => /\{who\}/.test(p))).toBe(true);
|
|
62
|
+
expect(problems.some((p) => /shell syntax/.test(p))).toBe(true);
|
|
63
|
+
expect(() => assertProductWords(PLYWOOD, { jobs: ["plan"] })).toThrow(/commands.up needs a apply job/);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("the active words are set for a command and put back after it", async () => {
|
|
67
|
+
expect(activeProductWords()).toBe(CHANT_WORDS);
|
|
68
|
+
const seen = await withProductWords(PLYWOOD, async () => activeProductWords().product);
|
|
69
|
+
expect(seen).toBe("plywood");
|
|
70
|
+
expect(activeProductWords()).toBe(CHANT_WORDS);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("the comment grammar (moved from terragucci's comment.ts)", () => {
|
|
75
|
+
const tg = assertProductWords(TERRAGUCCI);
|
|
76
|
+
const pw = assertProductWords(PLYWOOD);
|
|
77
|
+
|
|
78
|
+
test("reads the product's commands and nothing addressed elsewhere", () => {
|
|
79
|
+
expect(parseProductComment(pw, "/plywood up")).toEqual({ kind: "apply" });
|
|
80
|
+
expect(parseProductComment(pw, "/plywood up wave-2")).toEqual({ kind: "apply", wave: 2 });
|
|
81
|
+
expect(parseProductComment(pw, "/plywood preview shop-dev")).toEqual({ kind: "plan", member: "shop-dev" });
|
|
82
|
+
expect(parseProductComment(pw, "/terragucci apply")).toBeUndefined();
|
|
83
|
+
expect(parseProductComment(tg, "/terragucci lock")).toEqual({ kind: "lock" });
|
|
84
|
+
expect(parseProductComment(tg, "/terragucci agent rename the bucket")).toEqual({ kind: "agent", ask: "rename the bucket" });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("refuses what it never runs, and anything unsafe", () => {
|
|
88
|
+
expect(parseProductComment(pw, "/plywood approve up")).toMatchObject({ kind: "refused", reason: expect.stringMatching(/never runs `approve`/) });
|
|
89
|
+
expect(parseProductComment(pw, "/plywood up\nrm -rf /")).toMatchObject({ kind: "refused" });
|
|
90
|
+
expect(parseProductComment(pw, "/plywood preview ../etc")).toMatchObject({ kind: "refused" });
|
|
91
|
+
expect(parseProductComment(pw, "/plywood up now")).toMatchObject({ kind: "refused" });
|
|
92
|
+
expect(parseProductComment(pw, "/plywood lock everything")).toMatchObject({ kind: "refused" });
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("an alias reads only where its variable turns it on", () => {
|
|
96
|
+
expect(parseProductComment(tg, "atlantis plan -d envs/dev/orders")).toBeUndefined();
|
|
97
|
+
expect(parseProductComment(tg, "atlantis plan -d ./envs/dev/orders/", { TG_ATLANTIS_COMMENTS: "1" })).toEqual({ kind: "plan", member: "envs/dev/orders" });
|
|
98
|
+
expect(parseProductComment(tg, "atlantis apply", { TG_ATLANTIS_COMMENTS: "1" })).toEqual({ kind: "apply" });
|
|
99
|
+
expect(parseProductComment(tg, "atlantis plan -w staging", { TG_ATLANTIS_COMMENTS: "1" })).toMatchObject({ kind: "refused" });
|
|
100
|
+
});
|
|
101
|
+
});
|