@intentius/chant 0.124.55 → 0.124.57
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/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +1 -2
- 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 +11 -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.map +1 -1
- package/dist/ci-control.js +3 -4
- package/dist/ci-estate.d.ts +24 -0
- package/dist/ci-estate.d.ts.map +1 -1
- package/dist/ci-estate.js +1 -2
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +2 -3
- 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 +7 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +38 -4
- package/dist/ci-product.d.ts +35 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +38 -4
- 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/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 +81 -0
- 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.map +1 -1
- package/dist/cli/handlers/ci-check.js +38 -9
- 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/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +14 -0
- package/dist/cli/handlers/pr.d.ts +5 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +346 -36
- package/dist/cli/handlers/run-wave.js +89 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +56 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +107 -0
- package/dist/cli/registry.d.ts +38 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/adoption.d.ts.map +1 -1
- package/dist/components/adoption.js +1 -2
- package/dist/components/auto-release.d.ts +5 -2
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +9 -4
- package/dist/components/capability.d.ts +47 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +25 -0
- package/dist/components/check-hooks.d.ts +4 -1
- package/dist/components/check-hooks.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/components/ci-services.js +1 -2
- package/dist/components/deploy-units.d.ts +12 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +20 -1
- package/dist/components/driver.d.ts +12 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +35 -1
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +4 -3
- package/dist/components/pr-env-ledger.d.ts.map +1 -1
- package/dist/components/pr-env-ledger.js +1 -2
- package/dist/components/pr-environment.d.ts +1 -1
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +1 -1
- package/dist/components/pr-pipeline.d.ts +137 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +164 -20
- package/dist/components/pr-run.d.ts +8 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +9 -4
- package/dist/components/product-pipeline.d.ts +35 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +24 -5
- package/dist/components/row-lease.d.ts +22 -1
- package/dist/components/row-lease.d.ts.map +1 -1
- package/dist/components/row-lease.js +32 -6
- package/dist/components/wave-plan.d.ts +8 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +18 -2
- 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 +47 -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/exit-codes.d.ts +7 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +7 -1
- package/dist/lexicon.d.ts +55 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +2 -3
- package/dist/lifecycle/gated-request.d.ts.map +1 -1
- package/dist/lifecycle/gated-request.js +1 -2
- package/dist/lifecycle/git.d.ts +39 -3
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +223 -15
- package/dist/lifecycle/lock-rows.d.ts +23 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -1
- package/dist/lifecycle/lock-rows.js +47 -8
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +4 -5
- package/dist/lifecycle/release-catalog.d.ts.map +1 -1
- package/dist/lifecycle/release-catalog.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +1 -2
- package/dist/lifecycle/release-status.d.ts +20 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -1
- package/dist/lifecycle/release-status.js +1 -22
- package/dist/lifecycle/resource-lock.d.ts +70 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -1
- package/dist/lifecycle/resource-lock.js +241 -5
- 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/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.js +21 -4
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/op-waves-capability-spec.d.ts +8 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
- package/dist/op/op-waves-capability-spec.js +21 -0
- package/dist/op/op-waves-release-port.js +1 -1
- package/dist/op/op-waves-release.d.ts +2 -1
- package/dist/op/op-waves-release.d.ts.map +1 -1
- package/dist/op/op-waves-release.js +1 -2
- package/dist/op/op-waves-run.d.ts +15 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +195 -31
- package/dist/op/op-waves-stand-down.d.ts.map +1 -1
- package/dist/op/op-waves-stand-down.js +1 -2
- package/dist/op/op-waves.d.ts +53 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +62 -6
- package/dist/op/runtime.d.ts +4 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +2 -3
- package/dist/otlp.d.ts.map +1 -1
- package/dist/otlp.js +1 -2
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -0
- package/dist/policy-source.d.ts.map +1 -1
- package/dist/policy-source.js +1 -2
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +56 -39
- package/dist/pr-loop.d.ts +9 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +22 -4
- 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 +70 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +116 -5
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +1 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +1 -2
- 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/wave-runtime.mjs +351 -328
- package/dist/workspace/ci-lock-grain.d.ts +5 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
- package/dist/workspace/ci-lock-grain.js +1 -7
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +5 -1
- package/dist/workspace/pr-report.schema.json +5 -0
- package/package.json +1 -1
- package/src/ci-agent.ts +1 -2
- 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 +14 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +3 -4
- package/src/ci-estate.ts +1 -2
- package/src/ci-identity-database.test.ts +2 -3
- package/src/ci-identity-targets.test.ts +1 -3
- package/src/ci-identity.ts +2 -3
- 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.ts +35 -6
- package/src/ci-product.ts +55 -4
- 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/cli/handlers/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.ts +69 -0
- 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 +38 -8
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/lifecycle.ts +13 -0
- package/src/cli/handlers/pr-before-merge.test.ts +1 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +1 -1
- package/src/cli/handlers/pr-endpoint.test.ts +1 -1
- package/src/cli/handlers/pr-green.test.ts +1 -1
- 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 +1 -1
- package/src/cli/handlers/pr-record.test.ts +34 -2
- package/src/cli/handlers/pr-waves-blocked.test.ts +1 -1
- package/src/cli/handlers/pr-waves.test.ts +1 -1
- package/src/cli/handlers/pr.test.ts +1 -1
- package/src/cli/handlers/pr.ts +311 -32
- package/src/cli/handlers/run-wave.ts +79 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +56 -2
- package/src/cli/parse-args.ts +77 -0
- package/src/cli/registry.ts +38 -0
- package/src/components/adoption.ts +1 -2
- package/src/components/auto-release.test.ts +4 -2
- package/src/components/auto-release.ts +9 -5
- package/src/components/capability.ts +60 -0
- package/src/components/check-hooks.ts +4 -1
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.ts +1 -2
- package/src/components/deploy-units.test.ts +18 -1
- package/src/components/deploy-units.ts +26 -1
- package/src/components/driver.ts +35 -1
- package/src/components/groups.ts +4 -2
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -0
- package/src/components/pr-env-ledger.ts +1 -2
- package/src/components/pr-env-run-bundle.test.ts +0 -20
- package/src/components/pr-environment.ts +1 -1
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.ts +244 -20
- package/src/components/pr-run.ts +17 -6
- package/src/components/pr-stale-job.test.ts +34 -0
- package/src/components/product-pipeline.ts +50 -8
- package/src/components/row-lease.test.ts +61 -1
- package/src/components/row-lease.ts +48 -7
- package/src/components/wave-plan.ts +18 -2
- 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 +49 -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/exit-codes.test.ts +3 -2
- package/src/exit-codes.ts +7 -1
- package/src/gate-decision-bundle.test.ts +0 -2
- package/src/lexicon.ts +57 -0
- package/src/lifecycle/control-entries-ledger.test.ts +2 -3
- package/src/lifecycle/gate-ledger.ts +2 -3
- package/src/lifecycle/gated-request.ts +1 -2
- package/src/lifecycle/git.test.ts +155 -0
- package/src/lifecycle/git.ts +213 -17
- package/src/lifecycle/lock-rows.test.ts +6 -1
- package/src/lifecycle/lock-rows.ts +58 -7
- package/src/lifecycle/query.ts +4 -5
- package/src/lifecycle/release-catalog.test.ts +3 -4
- package/src/lifecycle/release-catalog.ts +1 -1
- package/src/lifecycle/release-ledger.ts +1 -2
- package/src/lifecycle/release-status.test.ts +3 -4
- package/src/lifecycle/release-status.ts +1 -2
- package/src/lifecycle/resource-lock-wait.test.ts +292 -0
- package/src/lifecycle/resource-lock.ts +261 -7
- package/src/lifecycle/wave-plans.ts +33 -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.test.ts +7 -5
- package/src/op/gate.ts +20 -4
- package/src/op/index.ts +2 -0
- package/src/op/op-waves-after-plan.test.ts +11 -0
- package/src/op/op-waves-capability-spec.ts +20 -0
- package/src/op/op-waves-ledger-lock.test.ts +208 -0
- package/src/op/op-waves-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +78 -1
- package/src/op/op-waves-release-port.ts +1 -1
- package/src/op/op-waves-release.ts +2 -3
- package/src/op/op-waves-run.ts +196 -31
- package/src/op/op-waves-stand-down.ts +1 -2
- package/src/op/op-waves.ts +81 -6
- package/src/op/runtime.ts +6 -3
- package/src/otlp.ts +1 -2
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-source.ts +1 -2
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +54 -35
- package/src/pr-loop-bundle.test.ts +0 -2
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop.ts +30 -4
- 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 +159 -5
- package/src/pr-report-url.ts +1 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +1 -2
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/stage-hooks-bundle.test.ts +0 -2
- package/src/workspace/ci-lock-grain.ts +1 -2
- package/src/workspace/ci-run.ts +5 -1
- package/src/workspace/pr-report.schema.json +5 -0
|
@@ -11,6 +11,8 @@ import { findWorkspaceRoot } from "../../project-root";
|
|
|
11
11
|
import { resolvePromotionSource } from "../../components/promote-order";
|
|
12
12
|
import type { PrLoopPipelineOptions } from "../../components/pr-pipeline";
|
|
13
13
|
import { activeProductWords, isChantWords } from "../../ci-product-words";
|
|
14
|
+
import { PR_APPLY_MERGES, PR_MERGE_METHODS } from "../../pr-merge";
|
|
15
|
+
import { parseRespondList, type CiResponses } from "../../ci-respond";
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* The engine install lines the project's lexicons give (#4550,
|
|
@@ -53,8 +55,17 @@ async function engineSetupFor(path: string): Promise<string[]> {
|
|
|
53
55
|
* pull request before it merges, beside the record job.
|
|
54
56
|
* `--preview-comment` (#4620) writes the jobs that answer the product's plan
|
|
55
57
|
* comment with a preview of the pull request's head.
|
|
58
|
+
* `--pr-runner`, `--pr-variable`, `--pr-secret` and `--parallelism` (#4625)
|
|
59
|
+
* set each stage's runner, the plan and apply jobs' variables and passed
|
|
60
|
+
* secrets, and how many members the plan plans at once.
|
|
61
|
+
* `--merge auto --merge-token-env <VAR> [--merge-method <m>]` (#4636) merges
|
|
62
|
+
* the pull request after its update before merge. `--respond <list>`,
|
|
63
|
+
* `--decide-backend` and `--decide-model` (#4629) set the apply and note
|
|
64
|
+
* jobs' responses and the description check's service. {@link prLoopFlagsProblem}
|
|
65
|
+
* has checked all of them first.
|
|
56
66
|
*/
|
|
57
67
|
function prLoopOption(args: CommandContext["args"], reportUrl: string | undefined, requireReview = false, requireRunnerStart = false): PrLoopPipelineOptions {
|
|
68
|
+
const respond = args.respond ? (parseRespondList(args.respond) as CiResponses) : undefined;
|
|
58
69
|
// #4550: a product's bin set its words; the generated jobs answer its comment and run its bin.
|
|
59
70
|
const words = activeProductWords();
|
|
60
71
|
return {
|
|
@@ -71,10 +82,61 @@ function prLoopOption(args: CommandContext["args"], reportUrl: string | undefine
|
|
|
71
82
|
...(args.prEnv ? { prEnvironment: true } : {}),
|
|
72
83
|
...(args.applyBeforeMerge ? { applyBeforeMerge: true } : {}),
|
|
73
84
|
...(args.previewComment ? { previewComment: true } : {}),
|
|
85
|
+
// #4628: the note carries its target commit, and a push marks the open notes stale.
|
|
86
|
+
...(args.staleNotes ? { staleNotes: true } : {}),
|
|
74
87
|
...(args.requires ? { applyRequires: args.requires } : {}),
|
|
88
|
+
// #4625: where the jobs run, and what the jobs that plan or apply get.
|
|
89
|
+
...(args.prRunners ? { runners: Object.fromEntries(Object.entries(args.prRunners).map(([stage, labels]) => [stage, labels.length === 1 ? labels[0]! : labels])) } : {}),
|
|
90
|
+
...(args.prVariables ? { variables: args.prVariables } : {}),
|
|
91
|
+
...(args.prSecrets ? { secrets: args.prSecrets } : {}),
|
|
92
|
+
...(args.parallelism !== undefined ? { parallelism: args.parallelism } : {}),
|
|
93
|
+
// #4627: the plan refreshes each step's state first.
|
|
94
|
+
...(args.refresh ? { refresh: true } : {}),
|
|
95
|
+
// #4636: the update before merge merges with its own token.
|
|
96
|
+
...(args.merge === "auto" && args.mergeTokenEnv ? { applyMerge: { tokenEnv: args.mergeTokenEnv, ...(args.mergeMethod ? { method: args.mergeMethod as "merge" | "squash" | "rebase" } : {}) } } : {}),
|
|
97
|
+
// #4629: the responses on the apply and note jobs, and the description check's service.
|
|
98
|
+
...(respond && Object.keys(respond).length > 0 ? { respond } : {}),
|
|
99
|
+
...(args.decideBackend && args.decideModel ? { decide: { backend: args.decideBackend, model: args.decideModel } } : {}),
|
|
75
100
|
};
|
|
76
101
|
}
|
|
77
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Why the pull request loop's merge, respond, decide and plan flags (#4636,
|
|
105
|
+
* #4629, #4627) do not hold together on `chant build`, or undefined when
|
|
106
|
+
* they do. Each value is refused by name, as `pr-apply` and `pr-post` refuse
|
|
107
|
+
* it, so a build never writes a job that fails on its own line.
|
|
108
|
+
*/
|
|
109
|
+
export function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" | "applyBeforeMerge" | "merge" | "mergeTokenEnv" | "mergeMethod" | "respond" | "decideBackend" | "decideModel" | "targetDependents">): string | undefined {
|
|
110
|
+
const given = [
|
|
111
|
+
...(args.merge !== undefined ? ["--merge"] : []),
|
|
112
|
+
...(args.mergeTokenEnv !== undefined ? ["--merge-token-env"] : []),
|
|
113
|
+
...(args.mergeMethod !== undefined ? ["--merge-method"] : []),
|
|
114
|
+
...(args.respond !== undefined ? ["--respond"] : []),
|
|
115
|
+
...(args.decideBackend !== undefined ? ["--decide-backend"] : []),
|
|
116
|
+
...(args.decideModel !== undefined ? ["--decide-model"] : []),
|
|
117
|
+
];
|
|
118
|
+
if (!args.prLoop) return given.length > 0 ? `${given.join(", ")} set the pull request loop's jobs, so ${given.length === 1 ? "it needs" : "they need"} --pr-loop` : undefined;
|
|
119
|
+
if (args.targetDependents) return "--target-dependents widens a --target, and the pull request's plan job plans with no target, so build takes no --target-dependents; give it in the preview comment beside --target";
|
|
120
|
+
if (args.merge === undefined) {
|
|
121
|
+
if (args.mergeTokenEnv !== undefined || args.mergeMethod !== undefined) return "--merge-token-env and --merge-method go with --merge auto";
|
|
122
|
+
} else if (!(PR_APPLY_MERGES as readonly string[]).includes(args.merge)) {
|
|
123
|
+
return `--merge takes ${PR_APPLY_MERGES.join(" or ")}, not ${args.merge}`;
|
|
124
|
+
} else if (args.merge === "manual") {
|
|
125
|
+
if (args.mergeTokenEnv !== undefined || args.mergeMethod !== undefined) return "--merge manual leaves the merge to a person, so it takes no --merge-token-env or --merge-method";
|
|
126
|
+
} else {
|
|
127
|
+
if (!args.applyBeforeMerge) return "--merge auto merges a pull request once its update before merge applied, so it needs --apply-before-merge";
|
|
128
|
+
if (!args.mergeTokenEnv) return "--merge auto merges with a token of its own, never the job's: --merge-token-env <VAR> (on GitLab a protected variable)";
|
|
129
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(args.mergeTokenEnv)) return `--merge-token-env takes a variable name, not ${args.mergeTokenEnv}`;
|
|
130
|
+
if (args.mergeMethod !== undefined && !(PR_MERGE_METHODS as readonly string[]).includes(args.mergeMethod)) return `--merge-method takes ${PR_MERGE_METHODS.join(", ")}, not ${args.mergeMethod}`;
|
|
131
|
+
}
|
|
132
|
+
const respond = args.respond ? parseRespondList(args.respond) : {};
|
|
133
|
+
if ("error" in respond) return respond.error;
|
|
134
|
+
const check = respond.description === "check";
|
|
135
|
+
if (check && (!args.decideBackend || !args.decideModel)) return "--respond description=check asks a decide service, so it needs --decide-backend <name> and --decide-model <id>";
|
|
136
|
+
if (!check && (args.decideBackend !== undefined || args.decideModel !== undefined)) return "--decide-backend and --decide-model name the description check's service, so they go with --respond description=check";
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
78
140
|
/**
|
|
79
141
|
* `chant build --components --generate <lexicon>` — generate mode (#563,
|
|
80
142
|
* epic #551 Phase 3). Discovers `Component` declarations under `args.path`
|
|
@@ -101,6 +163,13 @@ async function runGenerateComponents(ctx: CommandContext): Promise<number> {
|
|
|
101
163
|
const { args } = ctx;
|
|
102
164
|
const lexicon = args.generate as string;
|
|
103
165
|
|
|
166
|
+
// #4636, #4629, #4627: the pull request loop's flags are checked before anything loads.
|
|
167
|
+
const flagsProblem = prLoopFlagsProblem(args);
|
|
168
|
+
if (flagsProblem) {
|
|
169
|
+
console.error(formatError({ message: flagsProblem }));
|
|
170
|
+
return 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
104
173
|
const { config } = await loadChantConfigUpward(resolve(args.path)).catch(() => ({ config: {} as ChantConfig }));
|
|
105
174
|
const paramsResolution = resolveCliBuildParams(config.buildParams, {
|
|
106
175
|
cli: parseParamFlags(args.param),
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant ci check-job` (#4624): one test per refusal, on each forge, from
|
|
3
|
+
* the expectation in CHANT_JOB_GUARD. The forge's variables and its token
|
|
4
|
+
* endpoint are fakes. Written for the ci-products post-merge pass.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
|
8
|
+
import type { CommandContext } from "../registry";
|
|
9
|
+
import { runCiCheckJob } from "./ci-check-job";
|
|
10
|
+
import { JOB_GUARD_ENV, type JobGuardSpec } from "../../ci-job-guard";
|
|
11
|
+
|
|
12
|
+
const ctx = { args: {}, plugins: [], serializers: [] } as unknown as CommandContext;
|
|
13
|
+
const jwt = (claims: Record<string, unknown>): string => `h.${Buffer.from(JSON.stringify(claims)).toString("base64url")}.s`;
|
|
14
|
+
const tokenFetch = (claims: Record<string, unknown>) =>
|
|
15
|
+
(async () => ({ ok: true, status: 200, json: async () => ({ value: jwt(claims) }) })) as unknown as typeof fetch;
|
|
16
|
+
const noFetch = (async () => {
|
|
17
|
+
throw new Error("no fetch");
|
|
18
|
+
}) as unknown as typeof fetch;
|
|
19
|
+
|
|
20
|
+
let errors: string[];
|
|
21
|
+
let logs: string[];
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
errors = [];
|
|
24
|
+
logs = [];
|
|
25
|
+
vi.spyOn(console, "error").mockImplementation((m: unknown) => void errors.push(String(m)));
|
|
26
|
+
vi.spyOn(console, "log").mockImplementation((m: unknown) => void logs.push(String(m)));
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => vi.restoreAllMocks());
|
|
29
|
+
|
|
30
|
+
const withSpec = (spec: JobGuardSpec, env: Record<string, string>) => ({ [JOB_GUARD_ENV]: JSON.stringify(spec), ...env });
|
|
31
|
+
const gh: JobGuardSpec = { forge: "github", job: "wave 1 (prod) of deploy", forgeEnvironment: "prod", branches: ["main"], selfHosted: true };
|
|
32
|
+
const tokenEnv = { ACTIONS_ID_TOKEN_REQUEST_URL: "https://t?x=1", ACTIONS_ID_TOKEN_REQUEST_TOKEN: "b" };
|
|
33
|
+
|
|
34
|
+
describe("chant ci check-job on GitHub", () => {
|
|
35
|
+
test("passes where the spec set the job to run", async () => {
|
|
36
|
+
const code = await runCiCheckJob(ctx, withSpec(gh, { GITHUB_REF: "refs/heads/main", ...tokenEnv }), tokenFetch({ environment: "prod", runner_environment: "self-hosted" }));
|
|
37
|
+
expect(code).toBe(0);
|
|
38
|
+
expect(logs[0]).toBe("chant check-job: wave 1 (prod) of deploy: forge environment prod, ref refs/heads/main, self-hosted runner");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("refuses another forge environment", async () => {
|
|
42
|
+
const code = await runCiCheckJob(ctx, withSpec(gh, { GITHUB_REF: "refs/heads/main", ...tokenEnv }), tokenFetch({ environment: "staging", runner_environment: "self-hosted" }));
|
|
43
|
+
expect(code).toBe(9);
|
|
44
|
+
expect(errors[0]).toContain("forge environment: expected prod, found staging");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("refuses a job that cannot read its environment", async () => {
|
|
48
|
+
const code = await runCiCheckJob(ctx, withSpec(gh, { GITHUB_REF: "refs/heads/main" }), noFetch);
|
|
49
|
+
expect(code).toBe(9);
|
|
50
|
+
expect(errors[0]).toContain("it needs the id-token: write permission");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("refuses another ref", async () => {
|
|
54
|
+
const code = await runCiCheckJob(ctx, withSpec(gh, { GITHUB_REF: "refs/heads/feature", ...tokenEnv }), tokenFetch({ environment: "prod", runner_environment: "self-hosted" }));
|
|
55
|
+
expect(code).toBe(9);
|
|
56
|
+
expect(errors[0]).toContain("ref: expected refs/heads/main, found refs/heads/feature");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("refuses a hosted runner where the spec asks for a self-hosted one", async () => {
|
|
60
|
+
const code = await runCiCheckJob(ctx, withSpec(gh, { GITHUB_REF: "refs/heads/main", ...tokenEnv }), tokenFetch({ environment: "prod", runner_environment: "github-hosted" }));
|
|
61
|
+
expect(code).toBe(9);
|
|
62
|
+
expect(errors[0]).toContain("runner: expected self-hosted, found github-hosted");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("chant ci check-job on GitLab", () => {
|
|
67
|
+
const gl: JobGuardSpec = { forge: "gitlab", job: "wave 1 (prod) of deploy", product: "plywood", forgeEnvironment: "prod", branches: ["main"], runnerTags: ["deploy"] };
|
|
68
|
+
const ok = { CI_ENVIRONMENT_NAME: "prod", CI_COMMIT_REF_NAME: "main", CI_COMMIT_REF_PROTECTED: "true", CI_RUNNER_TAGS: "deploy" };
|
|
69
|
+
|
|
70
|
+
test("passes", async () => {
|
|
71
|
+
expect(await runCiCheckJob(ctx, withSpec(gl, ok), noFetch)).toBe(0);
|
|
72
|
+
expect(logs[0]).toMatch(/^plywood check-job: /);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("refuses another environment", async () => {
|
|
76
|
+
expect(await runCiCheckJob(ctx, withSpec(gl, { ...ok, CI_ENVIRONMENT_NAME: "dev" }), noFetch)).toBe(9);
|
|
77
|
+
expect(errors[0]).toBe("plywood check-job: wave 1 (prod) of deploy: forge environment: expected prod, found dev");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test("refuses another ref, and an unprotected one", async () => {
|
|
81
|
+
expect(await runCiCheckJob(ctx, withSpec(gl, { ...ok, CI_COMMIT_REF_NAME: "feature", CI_COMMIT_REF_PROTECTED: "false" }), noFetch)).toBe(9);
|
|
82
|
+
expect(errors).toContain("plywood check-job: wave 1 (prod) of deploy: ref: expected main, found feature");
|
|
83
|
+
expect(errors).toContain("plywood check-job: wave 1 (prod) of deploy: ref: expected a protected ref (CI_COMMIT_REF_PROTECTED true), found false");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("refuses a runner without the job's tags", async () => {
|
|
87
|
+
expect(await runCiCheckJob(ctx, withSpec(gl, { ...ok, CI_RUNNER_TAGS: "shared" }), noFetch)).toBe(9);
|
|
88
|
+
expect(errors[0]).toContain("runner: expected tags deploy, found shared");
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe("chant ci check-job on Forgejo", () => {
|
|
93
|
+
const fj: JobGuardSpec = { forge: "forgejo", job: "wave 1 (prod) of deploy", branches: ["main"], selfHosted: true };
|
|
94
|
+
|
|
95
|
+
test("checks no environment", async () => {
|
|
96
|
+
expect(await runCiCheckJob(ctx, withSpec(fj, { GITHUB_REF: "refs/heads/main", RUNNER_ENVIRONMENT: "self-hosted" }), noFetch)).toBe(0);
|
|
97
|
+
expect(logs[0]).toContain("not checked: forge environment (Forgejo has none)");
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("refuses another ref", async () => {
|
|
101
|
+
expect(await runCiCheckJob(ctx, withSpec(fj, { GITHUB_REF: "refs/heads/dev" }), noFetch)).toBe(9);
|
|
102
|
+
expect(errors[0]).toContain("ref: expected refs/heads/main, found refs/heads/dev");
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test("refuses a hosted runner", async () => {
|
|
106
|
+
expect(await runCiCheckJob(ctx, withSpec(fj, { GITHUB_REF: "refs/heads/main", RUNNER_ENVIRONMENT: "github-hosted" }), noFetch)).toBe(9);
|
|
107
|
+
expect(errors[0]).toContain("runner: expected self-hosted, found github-hosted");
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test("no expectation in the job stops it", async () => {
|
|
112
|
+
expect(await runCiCheckJob(ctx, {}, noFetch)).toBe(9);
|
|
113
|
+
expect(errors[0]).toContain(`${JOB_GUARD_ENV} is not set`);
|
|
114
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant ci check-job` (#4624): the apply-job guard as a command, for a
|
|
3
|
+
* product that renders its own jobs (`plywood ci check-job`, `terragucci ci
|
|
4
|
+
* check-job` through the product's bin). It reads the job's expectation
|
|
5
|
+
* from CHANT_JOB_GUARD, as the generated op-wave step does, checks it
|
|
6
|
+
* against what the forge tells the job, and exits chant's `misplaced` (9)
|
|
7
|
+
* with one line per value that differs, or when the variable holds no spec. See ../../ci-job-guard.ts.
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandContext } from "../registry";
|
|
10
|
+
|
|
11
|
+
export async function runCiCheckJob(_ctx: CommandContext, env: NodeJS.ProcessEnv = process.env, fetchFn: typeof fetch = fetch): Promise<number> {
|
|
12
|
+
const [{ parseJobGuardSpec, jobSeen, checkJob, describeJobGuard, JOB_GUARD_ENV }, { CHANT_EXIT }, { activeProductWords }] = await Promise.all([
|
|
13
|
+
import("../../ci-job-guard"),
|
|
14
|
+
import("../../exit-codes"),
|
|
15
|
+
import("../../ci-product-words"),
|
|
16
|
+
]);
|
|
17
|
+
let spec;
|
|
18
|
+
try {
|
|
19
|
+
spec = parseJobGuardSpec(env[JOB_GUARD_ENV]);
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.error(`${activeProductWords().product} check-job: ${err instanceof Error ? err.message : String(err)}`);
|
|
22
|
+
return CHANT_EXIT.misplaced;
|
|
23
|
+
}
|
|
24
|
+
if (spec.product === undefined) {
|
|
25
|
+
const product = activeProductWords().product;
|
|
26
|
+
if (product !== "chant") spec = { ...spec, product };
|
|
27
|
+
}
|
|
28
|
+
const seen = await jobSeen(spec, env, fetchFn);
|
|
29
|
+
const { ok, out, err } = describeJobGuard(spec, checkJob(spec, seen));
|
|
30
|
+
for (const line of out) console.log(line);
|
|
31
|
+
for (const line of err) console.error(line);
|
|
32
|
+
return ok ? CHANT_EXIT.done : CHANT_EXIT.misplaced;
|
|
33
|
+
}
|
|
@@ -3,12 +3,37 @@
|
|
|
3
3
|
* (#4556): run the `ci.hooks.check` hooks the workspace declaration at
|
|
4
4
|
* `--base` names, as a product's check job does. Each target is a root,
|
|
5
5
|
* stack or component the change touches; a `perRun` hook runs once per
|
|
6
|
-
* target.
|
|
7
|
-
*
|
|
6
|
+
* target. Then each lexicon the project lists runs its own check steps for
|
|
7
|
+
* the members of its kinds (#4633, `LexiconPlugin.checkSteps`): the pulumi
|
|
8
|
+
* lexicon's `pulumi install`, stack config check and `pulumi about`. Exits 0
|
|
9
|
+
* when every hook and step passed or there were none, 1 (`failed`) when one
|
|
10
|
+
* failed. See `../../components/check-hooks.ts` and
|
|
11
|
+
* `../../components/check-steps.ts`.
|
|
8
12
|
*/
|
|
13
|
+
import { resolve } from "node:path";
|
|
14
|
+
import type { CheckStepsAdapter } from "../../components/check-steps";
|
|
15
|
+
import { CHANT_EXIT } from "../../exit-codes";
|
|
9
16
|
import { formatError } from "../format";
|
|
10
17
|
import type { CommandContext } from "../registry";
|
|
11
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The check steps of the lexicons the project at `cwd` lists, best effort:
|
|
21
|
+
* a directory with no chant project, or a lexicon that does not load, gives
|
|
22
|
+
* none, and the hooks still run.
|
|
23
|
+
*/
|
|
24
|
+
async function lexiconCheckSteps(ctx: CommandContext, cwd: string): Promise<CheckStepsAdapter[]> {
|
|
25
|
+
let plugins = ctx.plugins ?? [];
|
|
26
|
+
if (plugins.length === 0) {
|
|
27
|
+
try {
|
|
28
|
+
const { loadPlugins, resolveProjectLexicons } = await import("../plugins");
|
|
29
|
+
plugins = await loadPlugins(await resolveProjectLexicons(resolve(cwd)));
|
|
30
|
+
} catch {
|
|
31
|
+
plugins = [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return plugins.map((p) => p.checkSteps?.()).filter((a): a is CheckStepsAdapter => a !== undefined);
|
|
35
|
+
}
|
|
36
|
+
|
|
12
37
|
const USAGE = "chant ci check --base <rev> [<target>...] [--output <dir>] [--json]";
|
|
13
38
|
|
|
14
39
|
export async function runCiCheck(ctx: CommandContext): Promise<number> {
|
|
@@ -18,16 +43,21 @@ export async function runCiCheck(ctx: CommandContext): Promise<number> {
|
|
|
18
43
|
return 1;
|
|
19
44
|
}
|
|
20
45
|
const targets = (args.positionals ?? []).slice(1);
|
|
21
|
-
const {
|
|
46
|
+
const { runCheckStage } = await import("../../components/check-steps");
|
|
22
47
|
let report;
|
|
23
48
|
try {
|
|
24
|
-
|
|
49
|
+
const adapters = await lexiconCheckSteps(ctx, process.cwd());
|
|
50
|
+
report = await runCheckStage({ base: args.base, targets, adapters, ...(args.output ? { dir: args.output } : {}) });
|
|
25
51
|
} catch (err) {
|
|
26
52
|
console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
|
|
27
|
-
return
|
|
53
|
+
return CHANT_EXIT.failed;
|
|
28
54
|
}
|
|
29
55
|
if (args.json) console.log(JSON.stringify(report, null, 2));
|
|
30
|
-
else if (report.status === "none") console.error("ci check: no ci.hooks.check at base, so nothing ran");
|
|
31
|
-
else
|
|
32
|
-
|
|
56
|
+
else if (report.status === "none") console.error("ci check: no ci.hooks.check at base and no lexicon check step, so nothing ran");
|
|
57
|
+
else {
|
|
58
|
+
const all = [...report.hooks, ...(report.steps ?? [])];
|
|
59
|
+
console.error(`ci check: ${all.filter((h) => h.outcome === "passed").length} passed, ${all.filter((h) => h.outcome === "failed").length} failed, ${all.filter((h) => h.outcome === "skipped").length} skipped`);
|
|
60
|
+
if (report.failed) console.error(`ci check: ${report.failed}`);
|
|
61
|
+
}
|
|
62
|
+
return report.status === "failed" ? CHANT_EXIT.failed : CHANT_EXIT.done;
|
|
33
63
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { formatError } from "../format";
|
|
2
|
+
import type { CommandContext } from "../registry";
|
|
3
|
+
|
|
4
|
+
const USAGE = "chant e2e safe-run [--scan <dir>]... -- <command...>";
|
|
5
|
+
|
|
6
|
+
/** `chant e2e <word>` with a word that is not a verb. */
|
|
7
|
+
export async function runE2eUnknown(ctx: CommandContext): Promise<number> {
|
|
8
|
+
console.error(formatError({ message: `Unknown e2e command: ${ctx.args.path}`, hint: USAGE }));
|
|
9
|
+
return 2;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `chant e2e safe-run [--scan <dir>]... -- <command...>` (chant#4587, C1): the
|
|
14
|
+
* harness's no-real-cloud wrapper (`../../e2e-harness/safe-run.ts`) for a
|
|
15
|
+
* driver that is not TypeScript. Exit codes: the command's own code after a
|
|
16
|
+
* CLEAN scan, 3 when the scan rejects the run, 2 for a usage error or a
|
|
17
|
+
* refused environment.
|
|
18
|
+
*/
|
|
19
|
+
export async function runE2eSafeRun(ctx: CommandContext): Promise<number> {
|
|
20
|
+
const command = (ctx.args.positionals ?? []).slice(1);
|
|
21
|
+
if (command.length === 0) {
|
|
22
|
+
console.error(formatError({ message: "chant e2e safe-run needs a command after --", hint: USAGE }));
|
|
23
|
+
return 2;
|
|
24
|
+
}
|
|
25
|
+
const { runSafeRunCommand } = await import("../../e2e-harness/safe-run-cli");
|
|
26
|
+
return runSafeRunCommand({ command, scan: ctx.args.scanDirs ?? [] });
|
|
27
|
+
}
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
} from "../../observation";
|
|
38
38
|
import { describeIdentities, identityStatusText, type IdentityRow } from "../../identity";
|
|
39
39
|
import { discoverComponents } from "../../components/discover";
|
|
40
|
+
import { changedFilesBetween, lexiconChangedUnits } from "../../components/changed-files";
|
|
40
41
|
import { cfnDeployStacks } from "./components";
|
|
41
42
|
import { affectedStacks } from "../../lifecycle/affected";
|
|
42
43
|
import { rollbackToRevision } from "../../lifecycle/rollback";
|
|
@@ -2131,6 +2132,18 @@ export async function runLifecycleAffected(ctx: CommandContext): Promise<number>
|
|
|
2131
2132
|
headRef: args.head,
|
|
2132
2133
|
includeDependents: args.includeDependents,
|
|
2133
2134
|
});
|
|
2135
|
+
// Units that are not chant source, a Terraform root or a Pulumi stack, never
|
|
2136
|
+
// show in the artifact diff; the lexicon that owns each answers from the
|
|
2137
|
+
// changed paths (#3183), as `components pr-plan` and `fan-out --base` add them.
|
|
2138
|
+
if (plugins.some((p) => p.changedUnits)) {
|
|
2139
|
+
const root = resolve(".");
|
|
2140
|
+
const units = await lexiconChangedUnits(plugins, {
|
|
2141
|
+
projectRoot: root,
|
|
2142
|
+
config: config as Record<string, unknown>,
|
|
2143
|
+
changedFiles: await changedFilesBetween(root, args.base, args.head ?? "HEAD"),
|
|
2144
|
+
});
|
|
2145
|
+
if (units.length > 0) result = { ...result, changed: [...new Set([...result.changed, ...units])].sort() };
|
|
2146
|
+
}
|
|
2134
2147
|
} catch (err) {
|
|
2135
2148
|
console.error(formatError({ message: err instanceof Error ? err.message : String(err) }));
|
|
2136
2149
|
return 1;
|
|
@@ -87,7 +87,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
87
87
|
}));
|
|
88
88
|
vi.mock("../../lifecycle/git", async () => {
|
|
89
89
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
90
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
90
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
vi.mock("./run", () => ({
|
|
@@ -38,7 +38,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
38
38
|
}));
|
|
39
39
|
vi.mock("../../lifecycle/git", async () => {
|
|
40
40
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
41
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-deploy-inputs.test must not push chant/lifecycle"); } };
|
|
41
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-deploy-inputs.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-deploy-inputs.test must not push chant/lifecycle"); } };
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
vi.mock("./run", () => ({
|
|
@@ -53,7 +53,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
53
53
|
}));
|
|
54
54
|
vi.mock("../../lifecycle/git", async () => {
|
|
55
55
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
56
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-endpoint.test must not push chant/lifecycle"); } };
|
|
56
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-endpoint.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-endpoint.test must not push chant/lifecycle"); } };
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
vi.mock("./run", () => ({
|
|
@@ -44,7 +44,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
44
44
|
}));
|
|
45
45
|
vi.mock("../../lifecycle/git", async () => {
|
|
46
46
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
47
|
-
return { ...actual, pushLifecycleReport: async () => ({}) };
|
|
47
|
+
return { ...actual, pushLifecycleReport: async () => ({}), pushLifecycleRebasing: async () => ({}) };
|
|
48
48
|
});
|
|
49
49
|
const applied: GreenApplyRecord[] = [];
|
|
50
50
|
vi.mock("../../lifecycle/green-apply", async () => {
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pr-plan --comment-targets` (#4626): the preview comment's --target
|
|
3
|
+
* addresses, read from CHANT_PREVIEW_COMMENT with the product's grammar,
|
|
4
|
+
* narrow the plan with the same checks as --target, the report says which
|
|
5
|
+
* were narrowed, and a refused comment plans nothing. The setup is
|
|
6
|
+
* pr-plan-targets.test.ts's. Written for the ci-products post-merge pass.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
|
13
|
+
import type { DriverComponent } from "../../components/driver";
|
|
14
|
+
import type { DeployContext } from "../../components/capability";
|
|
15
|
+
import type { ParsedArgs } from "../registry";
|
|
16
|
+
|
|
17
|
+
const HEAD = "a".repeat(40);
|
|
18
|
+
const BASE = "b".repeat(40);
|
|
19
|
+
|
|
20
|
+
vi.mock("../../workspace/security", async (original) => ({
|
|
21
|
+
...(await original<typeof import("../../workspace/security")>()),
|
|
22
|
+
securityGroupsAt: () => new Set<string>(),
|
|
23
|
+
}));
|
|
24
|
+
vi.mock("../../components/pr-hooks", async (original) => ({
|
|
25
|
+
...(await original<typeof import("../../components/pr-hooks")>()),
|
|
26
|
+
prLoopHooksAt: (_cwd: string, base: string) => ({ hooks: {}, base }),
|
|
27
|
+
}));
|
|
28
|
+
vi.mock("../../workspace/ci-locks", () => ({ ciLocksAt: () => null }));
|
|
29
|
+
vi.mock("../../components/pr-policy", async (original) => ({
|
|
30
|
+
...(await original<typeof import("../../components/pr-policy")>()),
|
|
31
|
+
prLoopPolicyAt: (_cwd: string, base: string) => ({ base }),
|
|
32
|
+
runPrPolicy: () => undefined,
|
|
33
|
+
}));
|
|
34
|
+
vi.mock("../../components/changed-files", () => ({
|
|
35
|
+
resolveCommit: async () => HEAD,
|
|
36
|
+
resolveMergeBase: async () => BASE,
|
|
37
|
+
}));
|
|
38
|
+
vi.mock("../../config", async () => {
|
|
39
|
+
const actual = await vi.importActual<typeof import("../../config")>("../../config");
|
|
40
|
+
return { ...actual, loadChantConfig: async () => ({ config: {} }) };
|
|
41
|
+
});
|
|
42
|
+
vi.mock("./fan-out", () => ({
|
|
43
|
+
resolveChangedUnits: async () => ({ units: { changed: ["net"], indeterminate: [] } }),
|
|
44
|
+
}));
|
|
45
|
+
vi.mock("../../lifecycle/git", async () => {
|
|
46
|
+
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
47
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-comment-targets.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-plan-comment-targets.test must not push chant/lifecycle"); } };
|
|
48
|
+
});
|
|
49
|
+
vi.mock("./run", () => ({
|
|
50
|
+
GATED_EXIT_CODE: 3,
|
|
51
|
+
autoReleaseRun: (id: string) => ({ runId: id, runOrigin: { forge: "local" } }),
|
|
52
|
+
recordAutoReleasesForRun: async () => [],
|
|
53
|
+
}));
|
|
54
|
+
let gateLedger: ReturnType<typeof import("../../op/gate").memoryGateLedgerPort>;
|
|
55
|
+
vi.mock("../../op/gate", async () => {
|
|
56
|
+
const actual = await vi.importActual<typeof import("../../op/gate")>("../../op/gate");
|
|
57
|
+
return { ...actual, gitGateLedgerPort: () => gateLedger, gateIsSealed: async () => false };
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/** The targets each member's plan was asked for. */
|
|
61
|
+
const asked = new Map<string, string[] | undefined>();
|
|
62
|
+
let estate: DriverComponent[] = [];
|
|
63
|
+
vi.mock("../../components/fan-out-support", async () => {
|
|
64
|
+
const { CapabilityRegistry } = await import("../../components/capability");
|
|
65
|
+
const { planFanOut } = await import("../../components/fan-out");
|
|
66
|
+
const { computePlanDigest } = await import("../../lifecycle/plan-digest");
|
|
67
|
+
const registry = new CapabilityRegistry();
|
|
68
|
+
const plan = (kind: string) => async (ctx: DeployContext, input: { root: string }) => {
|
|
69
|
+
asked.set(input.root, ctx.targets);
|
|
70
|
+
const planDigest = computePlanDigest(kind, { root: input.root });
|
|
71
|
+
return {
|
|
72
|
+
member: input.root,
|
|
73
|
+
planDigest,
|
|
74
|
+
artifact: { planDigest },
|
|
75
|
+
...(ctx.targets ? { targets: ctx.targets } : {}),
|
|
76
|
+
changeSet: { member: { member: input.root, lexicon: "terraform", planner: "tofu", status: "planned", planDigest, holes: [] }, entries: [] },
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
registry.register({ kind: "narrowing-root", targets: "accept", plan: plan("narrowing-root"), async outputs() { return {}; }, async run() { return { outputs: {} }; } } as never);
|
|
80
|
+
registry.register({ kind: "whole-root", targets: { refuse: "a whole-root applies its root at once" }, plan: plan("whole-root"), async outputs() { return {}; }, async run() { return { outputs: {} }; } } as never);
|
|
81
|
+
return {
|
|
82
|
+
fanOutRegistry: async () => registry,
|
|
83
|
+
deriveFanOut: async () => ({
|
|
84
|
+
success: true,
|
|
85
|
+
components: estate,
|
|
86
|
+
plan: planFanOut({ components: estate, changed: estate.map((c) => c.name) }),
|
|
87
|
+
signal: { changed: estate.map((c) => c.name), indeterminate: [], unclaimed: [] },
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const root = (name: string, kind = "narrowing-root"): DriverComponent => ({ name, dependsOn: [], deploy: [{ phase: "Apply", steps: [{ kind, root: name }] }] });
|
|
93
|
+
|
|
94
|
+
const { memoryGateLedgerPort } = await import("../../op/gate");
|
|
95
|
+
const { runComponentsPrApply, runComponentsPrPlan } = await import("./pr");
|
|
96
|
+
|
|
97
|
+
let dir: string;
|
|
98
|
+
let errors: string[];
|
|
99
|
+
|
|
100
|
+
const ctx = (a: Partial<ParsedArgs>) =>
|
|
101
|
+
({ args: { command: "components", path: "pr-plan", format: "", fix: false, watch: false, verbose: false, help: false, live: false, base: "main", env: "prod", output: dir, pr: 12, ...a } as ParsedArgs, plugins: [] }) as never;
|
|
102
|
+
|
|
103
|
+
beforeEach(async () => {
|
|
104
|
+
dir = await mkdtemp(join(tmpdir(), "pr-targets-"));
|
|
105
|
+
errors = [];
|
|
106
|
+
asked.clear();
|
|
107
|
+
estate = [root("net"), root("app")];
|
|
108
|
+
gateLedger = memoryGateLedgerPort();
|
|
109
|
+
vi.spyOn(process.stdout, "write").mockImplementation(() => true);
|
|
110
|
+
vi.spyOn(console, "error").mockImplementation((...m: unknown[]) => { errors.push(m.map(String).join(" ")); });
|
|
111
|
+
vi.spyOn(console, "log").mockImplementation(() => {});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
afterEach(async () => {
|
|
115
|
+
vi.restoreAllMocks();
|
|
116
|
+
await rm(dir, { recursive: true, force: true });
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const digest = async (): Promise<string> => JSON.parse(await readFile(join(dir, "pr-plan.json"), "utf8")).digest as string;
|
|
120
|
+
|
|
121
|
+
const report = async (): Promise<Record<string, unknown>> => JSON.parse(await readFile(join(dir, "pr-plan.json"), "utf8")) as Record<string, unknown>;
|
|
122
|
+
|
|
123
|
+
const { setActiveProductWords } = await import("../../ci-product-words");
|
|
124
|
+
|
|
125
|
+
describe("pr-plan --comment-targets (#4626)", () => {
|
|
126
|
+
const before = process.env.CHANT_PREVIEW_COMMENT;
|
|
127
|
+
let words: ReturnType<typeof setActiveProductWords>;
|
|
128
|
+
// chant's own words name no plan command, so the test's product does.
|
|
129
|
+
beforeEach(() => {
|
|
130
|
+
words = setActiveProductWords({ commands: { plan: "plan", apply: "apply" } });
|
|
131
|
+
});
|
|
132
|
+
afterEach(() => {
|
|
133
|
+
setActiveProductWords(words);
|
|
134
|
+
if (before === undefined) delete process.env.CHANT_PREVIEW_COMMENT;
|
|
135
|
+
else process.env.CHANT_PREVIEW_COMMENT = before;
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("the comment's addresses reach each plan, and the report lists them as narrowed", async () => {
|
|
139
|
+
process.env.CHANT_PREVIEW_COMMENT = "/chant plan --target net:module.vpc --target aws_s3_bucket.logs";
|
|
140
|
+
expect(await runComponentsPrPlan(ctx({ commentTargets: true }))).toBe(0);
|
|
141
|
+
expect(asked.get("net")).toEqual(["aws_s3_bucket.logs", "module.vpc"]);
|
|
142
|
+
expect(asked.get("app")).toEqual(["aws_s3_bucket.logs"]);
|
|
143
|
+
expect((await report()).narrowed).toEqual({ app: ["aws_s3_bucket.logs"], net: ["aws_s3_bucket.logs", "module.vpc"] });
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("a comment with no target plans everything whole", async () => {
|
|
147
|
+
process.env.CHANT_PREVIEW_COMMENT = "/chant plan";
|
|
148
|
+
expect(await runComponentsPrPlan(ctx({ commentTargets: true }))).toBe(0);
|
|
149
|
+
expect(asked.get("net")).toBeUndefined();
|
|
150
|
+
expect((await report()).narrowed).toBeUndefined();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("a refused comment plans nothing", async () => {
|
|
154
|
+
process.env.CHANT_PREVIEW_COMMENT = "/chant plan --target a;b";
|
|
155
|
+
expect(await runComponentsPrPlan(ctx({ commentTargets: true }))).toBe(1);
|
|
156
|
+
expect(asked.size).toBe(0);
|
|
157
|
+
expect(errors.join("\n")).toMatch(/the preview comment is refused/);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("a comment target a member cannot take is refused by name, as --target is", async () => {
|
|
161
|
+
estate = [root("net"), root("db", "whole-root")];
|
|
162
|
+
process.env.CHANT_PREVIEW_COMMENT = "/chant plan --target aws_s3_bucket.logs";
|
|
163
|
+
expect(await runComponentsPrPlan(ctx({ commentTargets: true }))).toBe(1);
|
|
164
|
+
expect(asked.size).toBe(0);
|
|
165
|
+
});
|
|
166
|
+
});
|