@intentius/chant 0.124.55 → 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/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 +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.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 -3
- 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/pr.d.ts +5 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +259 -4
- 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/capability.d.ts +37 -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/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 +129 -3
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +153 -17
- 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/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 +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/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 +46 -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/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/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/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.d.ts.map +1 -1
- package/dist/op/op-waves-release.js +1 -2
- package/dist/op/op-waves-run.d.ts +7 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +96 -4
- 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 +35 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +46 -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 -3
- 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 +340 -327
- 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 +15 -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 -3
- 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/pr-plan-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr.ts +228 -4
- 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/capability.ts +50 -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/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 +232 -17
- 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/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 +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/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 +48 -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/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/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/index.ts +2 -0
- package/src/op/op-waves-after-plan.test.ts +12 -0
- package/src/op/op-waves-capability-spec.ts +20 -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.ts +1 -2
- package/src/op/op-waves-run.ts +94 -4
- package/src/op/op-waves-stand-down.ts +1 -2
- package/src/op/op-waves.ts +63 -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 +1 -1
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop.ts +30 -3
- 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
|
@@ -88,8 +88,10 @@
|
|
|
88
88
|
import type { ForgeKind } from "../pr-forge";
|
|
89
89
|
import { PR_APPLY_GATE } from "../pr-loop";
|
|
90
90
|
import { parseRequiresList } from "../pr-requires";
|
|
91
|
-
import { CI_IMAGE, GITHUB_JOB_TOKEN } from "../ci-jobs";
|
|
92
|
-
import { withoutForgeTokens } from "../ci-handover";
|
|
91
|
+
import { CI_IMAGE, GITHUB_JOB_TOKEN, githubSecret, PR_ENV_REPORT_DIR, type CiRunner } from "../ci-jobs";
|
|
92
|
+
import { FORGE_TOKEN_VARS, withoutForgeTokens } from "../ci-handover";
|
|
93
|
+
import { OIDC_REQUEST_VARS } from "../ci-identity";
|
|
94
|
+
import { parallelismProblem } from "../parallelism";
|
|
93
95
|
import { EMPTY_TREE_SHA } from "./changed-files";
|
|
94
96
|
import { layerWaves } from "../gated-waves";
|
|
95
97
|
import type { DriverComponent } from "./driver";
|
|
@@ -97,6 +99,7 @@ import type { GatedWavePipelineOptions } from "./gated-wave-pipeline";
|
|
|
97
99
|
import type { CloudTradeSpec, PipelineCloudIdentity } from "../ci-identity";
|
|
98
100
|
import { commentLine, resolveProductWords, type CiProductWords, type CiProductWordsInput } from "../ci-product-words";
|
|
99
101
|
import type { ControlTarget } from "../control/dispatch";
|
|
102
|
+
import { CI_RESPOND_ENV, respondList, type CiResponses } from "../ci-respond";
|
|
100
103
|
|
|
101
104
|
/** The variable `chant ci run` reads its runner key from (`RUNNER_KEY_ENV` in ../workspace/ci-green.ts). */
|
|
102
105
|
const RUNNER_KEY_ENV = "CHANT_RUNNER_KEY";
|
|
@@ -187,6 +190,14 @@ export interface PrLoopPipelineOptions {
|
|
|
187
190
|
* four. Only with `applyBeforeMerge`.
|
|
188
191
|
*/
|
|
189
192
|
applyRequires?: readonly string[];
|
|
193
|
+
/**
|
|
194
|
+
* Merge the pull request once its update before merge applied (#4636):
|
|
195
|
+
* `pr-apply --merge auto --merge-token-env <tokenEnv>`. The token is the
|
|
196
|
+
* merge's alone: on GitHub and Forgejo the job maps it from the secret of
|
|
197
|
+
* that name, on GitLab it is a protected variable the project sets. Only
|
|
198
|
+
* with `applyBeforeMerge`.
|
|
199
|
+
*/
|
|
200
|
+
applyMerge?: { tokenEnv: string; method?: "merge" | "squash" | "rebase" };
|
|
190
201
|
/**
|
|
191
202
|
* Stream each job's run events (#4007): `--events-json` on both commands,
|
|
192
203
|
* and `CHANT_RUN_EVENTS_DIR` set to {@link PR_LOOP_EVENTS_DIR}. Default false.
|
|
@@ -295,6 +306,136 @@ export interface PrLoopPipelineOptions {
|
|
|
295
306
|
* Default false.
|
|
296
307
|
*/
|
|
297
308
|
previewComment?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Where the pull request loop's jobs run (#4625), by stage: `plan` for the
|
|
311
|
+
* plan and the comment preview, `apply` for the apply jobs, the record
|
|
312
|
+
* job and a pull request environment's up, down and sweep, and `default`
|
|
313
|
+
* for every other job (the note jobs, the lock jobs, the control
|
|
314
|
+
* dispatch) and for a stage left out. A plywood `runners` key maps
|
|
315
|
+
* `preview` onto `plan` and `up` onto `apply`. Absent: the forge's
|
|
316
|
+
* default runner.
|
|
317
|
+
*/
|
|
318
|
+
runners?: PrLoopRunners;
|
|
319
|
+
/**
|
|
320
|
+
* Variables for the jobs that plan or apply (#4625): the plan, the
|
|
321
|
+
* comment preview, the apply and the record. Values as the forge reads
|
|
322
|
+
* them; a name of a forge token or a token request variable is refused.
|
|
323
|
+
*/
|
|
324
|
+
variables?: Record<string, string>;
|
|
325
|
+
/**
|
|
326
|
+
* Secrets passed to the same jobs (#4625), as `{ <variable>: <secret> }`:
|
|
327
|
+
* the repository secret named `<secret>` as `<variable>`. GitHub and
|
|
328
|
+
* Forgejo map `secrets.<secret>`; GitLab, where every job has the CI/CD
|
|
329
|
+
* variables, maps `$<secret>` when the names differ. The plan job still
|
|
330
|
+
* drops the forge tokens before the change's code runs, and a passed name
|
|
331
|
+
* of a forge token is refused.
|
|
332
|
+
*/
|
|
333
|
+
secrets?: Record<string, string>;
|
|
334
|
+
/**
|
|
335
|
+
* How many members of a wave the plan job plans at once (#4625): `pr-plan
|
|
336
|
+
* --parallelism <n>`, on the plan and the comment preview. Absent: all of
|
|
337
|
+
* a wave's members at once.
|
|
338
|
+
*/
|
|
339
|
+
parallelism?: number;
|
|
340
|
+
/**
|
|
341
|
+
* The plan narrows to the `--target` addresses of the preview comment
|
|
342
|
+
* (#4626): `pr-plan --comment-targets`, which reads the comment from
|
|
343
|
+
* {@link PREVIEW_COMMENT_ENV}. {@link prCommentPreviewJob} sets it on its
|
|
344
|
+
* own plan; a caller never needs to.
|
|
345
|
+
*/
|
|
346
|
+
commentTargets?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* The plan and the comment preview refresh each step's state first
|
|
349
|
+
* (#4627): `pr-plan --refresh`, pulumi/actions' `refresh`. A member whose
|
|
350
|
+
* capability cannot is refused by name. Default false.
|
|
351
|
+
*/
|
|
352
|
+
refresh?: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Stale marking (#4628): the plan note carries the target branch's commit
|
|
355
|
+
* it was posted against, and a `stale-notes` job on each push to the
|
|
356
|
+
* target branch marks every open pull request's note posted against
|
|
357
|
+
* another commit stale, naming the plan comment under `previewComment`,
|
|
358
|
+
* and sets its plan status back to pending ({@link prStaleJob}). Set
|
|
359
|
+
* from `--stale-notes` beside `--pr-loop`. Default false.
|
|
360
|
+
*/
|
|
361
|
+
staleNotes?: boolean;
|
|
362
|
+
/**
|
|
363
|
+
* The responses to pipeline events (#4629, ../ci-respond.ts), from
|
|
364
|
+
* `chant build --pr-loop --respond <list>`: the apply job and the
|
|
365
|
+
* plan-note job carry the list as `CHANT_RESPOND`. Absent, or every event
|
|
366
|
+
* at its default: neither job sets it.
|
|
367
|
+
*/
|
|
368
|
+
respond?: CiResponses;
|
|
369
|
+
/**
|
|
370
|
+
* The decide service the description check asks (#4629), from
|
|
371
|
+
* `--decide-backend` and `--decide-model`: the plan-note job passes both
|
|
372
|
+
* to `pr-post`. Needed with `respond.description: "check"`.
|
|
373
|
+
*/
|
|
374
|
+
decide?: { backend: string; model: string };
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** The `CHANT_RESPOND` value of `respond` (#4629), or undefined when every event is at its default. Throws on a description check with no decide service. */
|
|
378
|
+
export function prLoopRespondEnv(options: Pick<PrLoopPipelineOptions, "respond" | "decide">): Record<string, string> {
|
|
379
|
+
if (options.respond?.description === "check" && !options.decide) throw new Error("respond.description: check asks a decide service, so the pipeline needs decide: { backend, model }");
|
|
380
|
+
const list = options.respond ? respondList(options.respond) : "";
|
|
381
|
+
return list ? { [CI_RESPOND_ENV]: list } : {};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** The variable the comment preview's plan reads the comment from (#4626); never a shell argument. */
|
|
385
|
+
export const PREVIEW_COMMENT_ENV = "CHANT_PREVIEW_COMMENT";
|
|
386
|
+
|
|
387
|
+
/** Where the pull request loop's jobs run, by stage (#4625). */
|
|
388
|
+
export interface PrLoopRunners {
|
|
389
|
+
plan?: CiRunner;
|
|
390
|
+
apply?: CiRunner;
|
|
391
|
+
default?: CiRunner;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/** A pull request loop job's stage for its runner (#4625). */
|
|
395
|
+
export type PrLoopRunnerStage = keyof PrLoopRunners;
|
|
396
|
+
|
|
397
|
+
/** The runner of `stage` (#4625): the stage's own, else `default`, else undefined for the forge's default. */
|
|
398
|
+
export function prLoopRunner(options: Pick<PrLoopPipelineOptions, "runners">, stage: PrLoopRunnerStage): CiRunner | undefined {
|
|
399
|
+
return options.runners?.[stage] ?? options.runners?.default;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* The runner stage of a pull request loop job by its name (#4625), with a
|
|
404
|
+
* workspace member's `<member>-` prefix taken off first: the plan and the
|
|
405
|
+
* comment preview plan; the apply jobs, the record job and a pull request
|
|
406
|
+
* environment's up, down and sweep apply; every other job runs on the
|
|
407
|
+
* default.
|
|
408
|
+
*/
|
|
409
|
+
export function prLoopJobStage(name: string, member?: string): PrLoopRunnerStage {
|
|
410
|
+
const bare = member && name.startsWith(`${member}-`) ? name.slice(member.length + 1) : name;
|
|
411
|
+
if (bare === "plan" || bare === PR_COMMENT_PREVIEW_JOB) return "plan";
|
|
412
|
+
if (bare === "apply" || bare === "record" || /^apply-wave-\d+$/.test(bare) || bare === "env-up" || bare === "env-down" || bare === "env-sweep") return "apply";
|
|
413
|
+
return "default";
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* The variables and passed secrets of the jobs that plan or apply (#4625),
|
|
418
|
+
* as the forge spells them. Throws on a name the loop sets itself or a
|
|
419
|
+
* forge token, which the plan must be able to drop.
|
|
420
|
+
*/
|
|
421
|
+
export function prLoopPassedEnv(forge: ForgeKind, options: Pick<PrLoopPipelineOptions, "variables" | "secrets">): Record<string, string> {
|
|
422
|
+
const reserved = new Set<string>([...FORGE_TOKEN_VARS, ...OIDC_REQUEST_VARS, "BASE_SHA", "PR_NUMBER", "HEAD_SHA", "GREEN_SHA", "CHANT_RUN_EVENTS_DIR", "CHANT_RUNNER_KEY"]);
|
|
423
|
+
const out: Record<string, string> = {};
|
|
424
|
+
const name = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
425
|
+
for (const [key, value] of Object.entries(options.variables ?? {})) {
|
|
426
|
+
if (!name.test(key)) throw new Error(`the pull request jobs' variable ${JSON.stringify(key)} is not a variable name`);
|
|
427
|
+
if (reserved.has(key)) throw new Error(`the pull request jobs' variable ${key} is one the jobs set or drop themselves; give it another name`);
|
|
428
|
+
out[key] = value;
|
|
429
|
+
}
|
|
430
|
+
for (const [key, secret] of Object.entries(options.secrets ?? {})) {
|
|
431
|
+
if (!name.test(key) || !name.test(secret)) throw new Error(`the passed secret ${JSON.stringify(key)}: ${JSON.stringify(secret)} must map a variable name to a secret name`);
|
|
432
|
+
if (reserved.has(key)) throw new Error(`the passed secret ${key} is a name the jobs set or drop themselves, and the plan job drops the forge tokens before the change's code runs; pass it under another name`);
|
|
433
|
+
if (key in out) throw new Error(`${key} is both a variable and a passed secret of the pull request jobs; give one`);
|
|
434
|
+
if (forge === "gitlab") {
|
|
435
|
+
if (key !== secret) out[key] = `$${secret}`;
|
|
436
|
+
} else out[key] = githubSecret(secret);
|
|
437
|
+
}
|
|
438
|
+
return out;
|
|
298
439
|
}
|
|
299
440
|
|
|
300
441
|
/** The lock job's step names and commands (#4327), shared by the GitHub-shaped generators. */
|
|
@@ -428,13 +569,15 @@ export function prCommentPreviewJob(forge: ForgeKind, env: string, options: PrLo
|
|
|
428
569
|
const comment = commentLine(words, "plan");
|
|
429
570
|
if (!comment) throw new Error(`--preview-comment answers /${words.product} <plan command>, and the words name no plan command; name one in the words' commands, or drop --preview-comment`);
|
|
430
571
|
// The plan job's own command: the apply side's options never reach it, so they are left out here.
|
|
431
|
-
const { applyBeforeMerge: _early, applyRequires: _requires, applyOnMerge: _onMerge, ...planSide } = options;
|
|
432
|
-
|
|
572
|
+
const { applyBeforeMerge: _early, applyRequires: _requires, applyMerge: _merge, applyOnMerge: _onMerge, respond: _respond, decide: _decide, ...planSide } = options;
|
|
573
|
+
// #4626: the comment's --target addresses narrow the preview, read from the comment in a variable.
|
|
574
|
+
const [plan] = prLoopJobs(forge, env, { ...planSide, commentTargets: true }, member);
|
|
433
575
|
const github = forge !== "gitlab";
|
|
434
576
|
const prNumber = github ? "${{ github.event.issue.number }}" : `$${GITLAB_PREVIEW_PR_VAR}`;
|
|
577
|
+
// GitLab: whoever starts the target-branch pipeline passes the comment as CHANT_PREVIEW_COMMENT, a pipeline variable every job has.
|
|
435
578
|
const fromComment = (jobEnv: Record<string, string>): Record<string, string> => {
|
|
436
579
|
const { BASE_SHA: _base, ...rest } = jobEnv;
|
|
437
|
-
return github ? { ...rest, PR_NUMBER: prNumber } : { ...rest, PR_NUMBER: prNumber, BASE_SHA: "$CI_COMMIT_SHA" };
|
|
580
|
+
return github ? { ...rest, PR_NUMBER: prNumber, [PREVIEW_COMMENT_ENV]: "${{ github.event.comment.body }}" } : { ...rest, PR_NUMBER: prNumber, BASE_SHA: "$CI_COMMIT_SHA" };
|
|
438
581
|
};
|
|
439
582
|
const branch = options.branch ?? "main";
|
|
440
583
|
const base = github
|
|
@@ -446,9 +589,12 @@ export function prCommentPreviewJob(forge: ForgeKind, env: string, options: PrLo
|
|
|
446
589
|
"--env", env, "--output", PR_LOOP_REPORT_DIR, "--forge", forge,
|
|
447
590
|
...(member ? ["--member", member] : []),
|
|
448
591
|
...(github ? ["--result", '"$PLAN_RESULT"'] : []),
|
|
592
|
+
// #4628: the target branch's commit the preview measured from, for the note's tip line.
|
|
593
|
+
...(options.staleNotes ? ["--tip", '"$TIP_SHA"'] : []),
|
|
449
594
|
].join(" "),
|
|
450
595
|
words.bin,
|
|
451
596
|
);
|
|
597
|
+
const tipEnv: Record<string, string> = options.staleNotes ? { TIP_SHA: github ? "${{ github.sha }}" : "$CI_COMMIT_SHA" } : {};
|
|
452
598
|
return {
|
|
453
599
|
jobName: PR_COMMENT_PREVIEW_JOB,
|
|
454
600
|
noteJobName: PR_COMMENT_PREVIEW_NOTE_JOB,
|
|
@@ -463,12 +609,13 @@ export function prCommentPreviewJob(forge: ForgeKind, env: string, options: PrLo
|
|
|
463
609
|
PR_NUMBER: prNumber,
|
|
464
610
|
HEAD_SHA: `\${{ needs.${PR_COMMENT_PREVIEW_JOB}.outputs.${PREVIEW_HEAD_OUTPUT} }}`,
|
|
465
611
|
PLAN_RESULT: `\${{ needs.${PR_COMMENT_PREVIEW_JOB}.result }}`,
|
|
612
|
+
...tipEnv,
|
|
466
613
|
GITHUB_TOKEN: GITHUB_JOB_TOKEN,
|
|
467
614
|
},
|
|
468
615
|
}
|
|
469
616
|
: {
|
|
470
617
|
command: postCommand,
|
|
471
|
-
env: { PR_NUMBER: prNumber },
|
|
618
|
+
env: { PR_NUMBER: prNumber, ...tipEnv },
|
|
472
619
|
setup: ['HEAD_SHA="$(git ls-remote origin "refs/merge-requests/$PR_NUMBER/head" | cut -f1)" && export HEAD_SHA'],
|
|
473
620
|
},
|
|
474
621
|
...(github ? {} : { gitlabVar: GITLAB_PREVIEW_PR_VAR }),
|
|
@@ -517,6 +664,8 @@ export interface PrLoopJob {
|
|
|
517
664
|
* pipeline never gets.
|
|
518
665
|
*/
|
|
519
666
|
run: { command: string; env: Record<string, string> };
|
|
667
|
+
/** Where the job runs (#4625), from the loop's `runners`: the plan's or the apply's, else `default`. Absent: the forge's default. */
|
|
668
|
+
runner?: CiRunner;
|
|
520
669
|
}
|
|
521
670
|
|
|
522
671
|
/** The lines `build` (#4088) runs before a job's command: the build, then the lint. Empty without the option. */
|
|
@@ -541,6 +690,10 @@ export function prLoopJobs(forge: ForgeKind, env: string, options: PrLoopPipelin
|
|
|
541
690
|
const asked = options.applyRequires ? parseRequiresList(options.applyRequires) : undefined;
|
|
542
691
|
if (asked && "error" in asked) throw new Error(asked.error);
|
|
543
692
|
const requires = early && asked ? ["--requires", asked.checks.join(",")] : [];
|
|
693
|
+
if (options.applyMerge && !early) throw new Error("--merge auto merges a pull request after its update before merge, so it needs --apply-before-merge");
|
|
694
|
+
if (options.applyMerge && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(options.applyMerge.tokenEnv)) throw new Error(`the merge token variable ${JSON.stringify(options.applyMerge.tokenEnv)} is not a variable name`);
|
|
695
|
+
// #4636: the merge after the update, with its own token.
|
|
696
|
+
const merge = early && options.applyMerge ? ["--merge", "auto", "--merge-token-env", options.applyMerge.tokenEnv, ...(options.applyMerge.method ? ["--merge-method", options.applyMerge.method] : [])] : [];
|
|
544
697
|
const common = [
|
|
545
698
|
"--env", env, "--gate", gate, "--output", PR_LOOP_REPORT_DIR, "--forge", forge,
|
|
546
699
|
...(member ? ["--member", member] : []),
|
|
@@ -550,15 +703,27 @@ export function prLoopJobs(forge: ForgeKind, env: string, options: PrLoopPipelin
|
|
|
550
703
|
const github = forge !== "gitlab";
|
|
551
704
|
const buildLines = prLoopBuildLines(env, options);
|
|
552
705
|
const build = buildLines.length > 0 ? { build: buildLines } : {};
|
|
706
|
+
// #4625: the caller's variables and passed secrets, in every job that plans or applies.
|
|
553
707
|
const jobEnv: Record<string, string> = {
|
|
708
|
+
...prLoopPassedEnv(forge, options),
|
|
554
709
|
...(github ? { GITHUB_TOKEN: GITHUB_JOB_TOKEN } : {}),
|
|
555
710
|
...(options.events ? { CHANT_RUN_EVENTS_DIR: PR_LOOP_EVENTS_DIR } : {}),
|
|
556
711
|
};
|
|
712
|
+
const planRunner = prLoopRunner(options, "plan");
|
|
713
|
+
if (options.parallelism !== undefined) {
|
|
714
|
+
const problem = parallelismProblem("parallelism", options.parallelism);
|
|
715
|
+
if (problem) throw new Error(`the pull request plan's ${problem}`);
|
|
716
|
+
}
|
|
717
|
+
const parallelism = options.parallelism !== undefined ? ["--parallelism", String(options.parallelism)] : [];
|
|
718
|
+
const applyRunner = prLoopRunner(options, "apply");
|
|
557
719
|
// #4156: the flags `chant ci run` rebuilds `command` from. It finds the member from the directory it runs in.
|
|
558
720
|
const ciRun = (job: PrLoopJob["jobName"]): string[] => [
|
|
559
721
|
"chant", "ci", "run", job, "--in-place", ...(job === "plan" ? ["--no-push"] : []),
|
|
560
722
|
...(job === "apply" && !early ? [] : ["--base", '"$BASE_SHA"']), ...(job === "plan" || (job === "apply" && early) ? ["--pr", '"$PR_NUMBER"'] : []),
|
|
561
|
-
...(job === "apply" && early ? ["--apply-before-merge", ...requires] : []),
|
|
723
|
+
...(job === "apply" && early ? ["--apply-before-merge", ...requires, ...merge] : []),
|
|
724
|
+
...(job === "plan" ? parallelism : []),
|
|
725
|
+
...(job === "plan" && options.commentTargets ? ["--comment-targets"] : []),
|
|
726
|
+
...(job === "plan" && options.refresh ? ["--refresh"] : []),
|
|
562
727
|
"--env", env, "--gate", gate, "--forge", forge,
|
|
563
728
|
...(job !== "record" && options.waveGate ? ["--wave-gate", options.waveGate] : []),
|
|
564
729
|
...(job !== "plan" && options.branch ? ["--branch", JSON.stringify(options.branch)] : []),
|
|
@@ -576,8 +741,9 @@ export function prLoopJobs(forge: ForgeKind, env: string, options: PrLoopPipelin
|
|
|
576
741
|
const greenBranch = github ? JSON.stringify(options.branch ?? "main") : options.branch ? JSON.stringify(options.branch) : "$CI_DEFAULT_BRANCH";
|
|
577
742
|
const applyEnv = github ? { BASE_SHA: "${{ github.event.before }}", ...jobEnv } : { BASE_SHA: "$CI_COMMIT_BEFORE_SHA", ...jobEnv };
|
|
578
743
|
// #4301: the apply before merge runs in a job of the target branch, whose commit is the base, at the pull request's head.
|
|
744
|
+
const mergeSecret = github && options.applyMerge ? { [options.applyMerge.tokenEnv]: `\${{ secrets.${options.applyMerge.tokenEnv} }}` } : {};
|
|
579
745
|
const earlyEnv = github
|
|
580
|
-
? { BASE_SHA: "${{ github.sha }}", PR_NUMBER: "${{ github.event.issue.number }}", ...jobEnv }
|
|
746
|
+
? { BASE_SHA: "${{ github.sha }}", PR_NUMBER: "${{ github.event.issue.number }}", ...jobEnv, ...mergeSecret }
|
|
581
747
|
: { BASE_SHA: "$CI_COMMIT_SHA", PR_NUMBER: `$${GITLAB_APPLY_PR_VAR}`, ...jobEnv };
|
|
582
748
|
const greenApply: PrLoopJob = {
|
|
583
749
|
// #4168 step 9: the apply applies the newest green commit, measured from the one applied before it.
|
|
@@ -591,6 +757,7 @@ export function prLoopJobs(forge: ForgeKind, env: string, options: PrLoopPipelin
|
|
|
591
757
|
env: jobEnv,
|
|
592
758
|
checkout: [greenCheckout(greenBranch)],
|
|
593
759
|
greenBranch,
|
|
760
|
+
...(applyRunner !== undefined ? { runner: applyRunner } : {}),
|
|
594
761
|
...build,
|
|
595
762
|
run: { command: ciRun("apply").join(" "), env: runEnv(jobEnv) },
|
|
596
763
|
};
|
|
@@ -598,32 +765,39 @@ export function prLoopJobs(forge: ForgeKind, env: string, options: PrLoopPipelin
|
|
|
598
765
|
// #4301: the requires checks run inside pr-apply, before any of the head's code loads.
|
|
599
766
|
jobName: "apply",
|
|
600
767
|
command: [
|
|
601
|
-
"chant", "components", "pr-apply", "--before-merge", ...requires, "--base", '"$BASE_SHA"', "--pr", '"$PR_NUMBER"', ...common,
|
|
768
|
+
"chant", "components", "pr-apply", "--before-merge", ...requires, ...merge, "--base", '"$BASE_SHA"', "--pr", '"$PR_NUMBER"', ...common,
|
|
602
769
|
...(options.requireReview === true ? ["--require-review"] : []),
|
|
603
770
|
"--resume", PR_APPLY_RECORD,
|
|
604
771
|
].join(" "),
|
|
605
772
|
env: earlyEnv,
|
|
606
773
|
checkout: [pullRequestCheckout(forge)],
|
|
774
|
+
...(applyRunner !== undefined ? { runner: applyRunner } : {}),
|
|
607
775
|
run: { command: ciRun("apply").join(" "), env: runEnv(earlyEnv) },
|
|
608
776
|
};
|
|
609
777
|
const bin = options.words?.bin;
|
|
778
|
+
// #4629: the apply posts a failed apply's triage and a refused one's diff as CHANT_RESPOND says.
|
|
779
|
+
const respondEnv = prLoopRespondEnv(options);
|
|
780
|
+
const withRespond = (job: PrLoopJob): PrLoopJob => (Object.keys(respondEnv).length > 0 ? { ...job, env: { ...job.env, ...respondEnv }, run: { ...job.run, env: { ...job.run.env, ...respondEnv } } } : job);
|
|
610
781
|
return [
|
|
611
782
|
{
|
|
612
783
|
jobName: "plan",
|
|
613
784
|
// With `waveGate` the plan's note says the later waves may stop at their own gates (#4003).
|
|
614
|
-
command: ["chant", "components", "pr-plan", "--base", '"$BASE_SHA"', "--pr", '"$PR_NUMBER"', ...common, ...(options.waveGate ? ["--wave-gate", options.waveGate] : []), "--no-status"].join(" "),
|
|
785
|
+
command: ["chant", "components", "pr-plan", "--base", '"$BASE_SHA"', "--pr", '"$PR_NUMBER"', ...common, ...(options.waveGate ? ["--wave-gate", options.waveGate] : []), ...parallelism, ...(options.commentTargets ? ["--comment-targets"] : []), ...(options.refresh ? ["--refresh"] : []), "--no-status"].join(" "),
|
|
615
786
|
env: planEnv,
|
|
616
787
|
...build,
|
|
788
|
+
...(planRunner !== undefined ? { runner: planRunner } : {}),
|
|
617
789
|
// #4328: no runner key either. The step drops it, but the job's environment is the pull request's code's too.
|
|
618
790
|
run: { command: ciRun("plan").join(" "), env: planEnv },
|
|
619
791
|
},
|
|
620
|
-
early ? earlyApply : greenApply,
|
|
792
|
+
withRespond(early ? earlyApply : greenApply),
|
|
621
793
|
{
|
|
622
794
|
jobName: "record",
|
|
623
795
|
command: ["chant", "components", "pr-record", "--base", '"$BASE_SHA"', ...common].join(" "),
|
|
624
796
|
env: applyEnv,
|
|
625
797
|
setup: [github ? githubBaseFallback(options.branch) : gitlabBaseFallback(options.branch)],
|
|
626
798
|
...build,
|
|
799
|
+
// The record runs on merge, where the apply would.
|
|
800
|
+
...(applyRunner !== undefined ? { runner: applyRunner } : {}),
|
|
627
801
|
run: { command: ciRun("record").join(" "), env: runEnv(applyEnv) },
|
|
628
802
|
},
|
|
629
803
|
].map((job) => jobWithBin(job as PrLoopJob, bin));
|
|
@@ -648,11 +822,21 @@ export const PR_PLAN_NOTE_JOB = "plan-note";
|
|
|
648
822
|
* asks GitLab for each open merge request's plan job and reads its report
|
|
649
823
|
* from the job's artifacts.
|
|
650
824
|
*/
|
|
651
|
-
export function prLoopPostJob(forge: ForgeKind, env: string, member?: string, words?: Pick<CiProductWordsInput, "bin">): { command: string; env: Record<string, string> } {
|
|
825
|
+
export function prLoopPostJob(forge: ForgeKind, env: string, member?: string, words?: Pick<CiProductWordsInput, "bin">, opts: { staleNotes?: boolean } & Pick<PrLoopPipelineOptions, "respond" | "decide"> = {}): { command: string; env: Record<string, string> } {
|
|
826
|
+
// #4629: the responses as CHANT_RESPOND, and with the description check its decide service on the line.
|
|
827
|
+
const respondEnv = prLoopRespondEnv(opts);
|
|
828
|
+
const decide = opts.respond?.description === "check" && opts.decide ? ` --decide-backend ${JSON.stringify(opts.decide.backend)} --decide-model ${JSON.stringify(opts.decide.model)}` : "";
|
|
829
|
+
const job = prLoopPostJobBase(forge, env, member, words, opts);
|
|
830
|
+
return decide || Object.keys(respondEnv).length > 0 ? { command: `${job.command}${decide}`, env: { ...job.env, ...respondEnv } } : job;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function prLoopPostJobBase(forge: ForgeKind, env: string, member: string | undefined, words: Pick<CiProductWordsInput, "bin"> | undefined, opts: { staleNotes?: boolean }): { command: string; env: Record<string, string> } {
|
|
834
|
+
// #4628: with staleNotes the note carries the target branch's commit, so a later push can mark it stale.
|
|
835
|
+
const tip = opts.staleNotes ? ["--tip", '"$TIP_SHA"'] : [];
|
|
652
836
|
if (forge === "gitlab") {
|
|
653
837
|
return {
|
|
654
|
-
command: withProductBin(["chant", "components", "pr-post", "--open", "--env", env, "--output", PR_LOOP_REPORT_DIR, "--forge", forge, ...(member ? ["--member", member] : [])].join(" "), words?.bin),
|
|
655
|
-
env: {},
|
|
838
|
+
command: withProductBin(["chant", "components", "pr-post", "--open", "--env", env, "--output", PR_LOOP_REPORT_DIR, "--forge", forge, ...(member ? ["--member", member] : []), ...tip].join(" "), words?.bin),
|
|
839
|
+
env: opts.staleNotes ? { TIP_SHA: "$CI_COMMIT_SHA" } : {},
|
|
656
840
|
};
|
|
657
841
|
}
|
|
658
842
|
const command = [
|
|
@@ -660,10 +844,42 @@ export function prLoopPostJob(forge: ForgeKind, env: string, member?: string, wo
|
|
|
660
844
|
"--env", env, "--output", PR_LOOP_REPORT_DIR, "--forge", forge,
|
|
661
845
|
...(member ? ["--member", member] : []),
|
|
662
846
|
"--result", '"$PLAN_RESULT"',
|
|
847
|
+
...tip,
|
|
663
848
|
].join(" ");
|
|
664
849
|
return {
|
|
665
850
|
command: withProductBin(command, words?.bin),
|
|
666
|
-
env: {
|
|
851
|
+
env: {
|
|
852
|
+
PR_NUMBER: "${{ github.event.pull_request.number }}",
|
|
853
|
+
HEAD_SHA: "${{ github.sha }}",
|
|
854
|
+
PLAN_RESULT: "${{ needs.plan.result }}",
|
|
855
|
+
...(opts.staleNotes ? { TIP_SHA: "${{ github.event.pull_request.base.sha }}" } : {}),
|
|
856
|
+
GITHUB_TOKEN: GITHUB_JOB_TOKEN,
|
|
857
|
+
},
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** The job that marks the open pull requests' notes stale after a push to the target branch (#4628). */
|
|
862
|
+
export const PR_STALE_JOB = "stale-notes";
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* The stale job's command and the values it reads (#4628), with
|
|
866
|
+
* `staleNotes`: on a push to the target branch, at its commit, `pr-post
|
|
867
|
+
* --stale` marks each open pull request's note posted against another
|
|
868
|
+
* commit stale and sets its plan status back to pending. It names the plan
|
|
869
|
+
* comment with `previewComment`. Undefined without `staleNotes`.
|
|
870
|
+
*/
|
|
871
|
+
export function prStaleJob(forge: ForgeKind, env: string, options: Pick<PrLoopPipelineOptions, "staleNotes" | "previewComment" | "branch" | "words"> = {}, member?: string): { command: string; env: Record<string, string> } | undefined {
|
|
872
|
+
if (!options.staleNotes) return undefined;
|
|
873
|
+
const words = resolveProductWords(options.words);
|
|
874
|
+
const command = [
|
|
875
|
+
"chant", "components", "pr-post", "--stale", "--tip", '"$TIP_SHA"', "--env", env, "--forge", forge,
|
|
876
|
+
...(options.branch ? ["--branch", JSON.stringify(options.branch)] : []),
|
|
877
|
+
...(member ? ["--member", member] : []),
|
|
878
|
+
...(options.previewComment ? ["--preview-comment"] : []),
|
|
879
|
+
].join(" ");
|
|
880
|
+
return {
|
|
881
|
+
command: withProductBin(command, words.bin),
|
|
882
|
+
env: forge === "gitlab" ? { TIP_SHA: "$CI_COMMIT_SHA" } : { TIP_SHA: "${{ github.sha }}", GITHUB_TOKEN: GITHUB_JOB_TOKEN },
|
|
667
883
|
};
|
|
668
884
|
}
|
|
669
885
|
|
|
@@ -873,8 +1089,7 @@ export function githubBaseFallback(branch?: string): string {
|
|
|
873
1089
|
return pushBaseFallback(JSON.stringify(branch ?? "main"), "$GITHUB_SHA");
|
|
874
1090
|
}
|
|
875
1091
|
|
|
876
|
-
|
|
877
|
-
export const PR_ENV_REPORT_DIR = ".chant/pr-env";
|
|
1092
|
+
export { PR_ENV_REPORT_DIR } from "../ci-jobs";
|
|
878
1093
|
|
|
879
1094
|
/** The cron the generated `env-sweep` job runs on (#4298): hourly, at a minute off the hour. */
|
|
880
1095
|
export const PR_ENV_SWEEP_CRON = "17 * * * *";
|
package/src/components/pr-run.ts
CHANGED
|
@@ -116,6 +116,7 @@ import type { RunEventSink } from "../run-event-stream";
|
|
|
116
116
|
import { capabilitySteps, planWaveComponent, readDeployedOutputs, type CapabilityPolicyFindings, type WaveComponentPlan } from "./wave-plan";
|
|
117
117
|
import type { PrMigrationFile } from "../pr-migrations";
|
|
118
118
|
import { markCrossStackEdges, type CrossStackRead } from "../control/edges";
|
|
119
|
+
import { mapLimited } from "../parallelism";
|
|
119
120
|
|
|
120
121
|
export interface PrPlanSetOptions {
|
|
121
122
|
/** Every component in the project, not the selection: a planned member's dependency outside it is read too (#4104). */
|
|
@@ -129,6 +130,12 @@ export interface PrPlanSetOptions {
|
|
|
129
130
|
seededOutputs?: Record<string, Record<string, unknown>>;
|
|
130
131
|
/** The addresses each component narrows to (#4300), by component: its steps' `DeployContext.targets`. */
|
|
131
132
|
targets?: Readonly<Record<string, readonly string[]>>;
|
|
133
|
+
/** How many members of a wave plan at once (#4625, `pr-plan --parallelism`); a group counts as one. Default: all of them. */
|
|
134
|
+
parallelism?: number;
|
|
135
|
+
/** `pr-plan --refresh` (#4627): every step's `DeployContext.refresh`. */
|
|
136
|
+
refresh?: boolean;
|
|
137
|
+
/** `pr-plan --target-dependents` (#4627): `DeployContext.targetDependents` for each component with targets. */
|
|
138
|
+
targetDependents?: boolean;
|
|
132
139
|
/** `ci.lockGrain` as declared at base (#4552); absent, each member takes its lexicon's default. */
|
|
133
140
|
lockGrain?: LockGrain;
|
|
134
141
|
/** The commit policy is read at (#4613), every step's `DeployContext.policyBase`: the pull request's base. */
|
|
@@ -184,6 +191,8 @@ export interface PrPlanSet {
|
|
|
184
191
|
groups?: PrPlanGroup[];
|
|
185
192
|
/** The components that could have grouped and did not, with why (ws-107, ruling 1): the fan-out's `fallbacks`. */
|
|
186
193
|
fallbacks?: FanOutGroupFallback[];
|
|
194
|
+
/** The addresses each component's plan was narrowed to (#4626, `pr-plan --target`), by component. Absent when nothing was narrowed. */
|
|
195
|
+
targets?: Record<string, string[]>;
|
|
187
196
|
/** Whether any component failed to plan. */
|
|
188
197
|
failed: boolean;
|
|
189
198
|
/** A capability's plan threw `policyDenied` (#4550): the stage exits 7, not 1. */
|
|
@@ -279,18 +288,18 @@ export async function planPrSet(options: PrPlanSetOptions): Promise<PrPlanSet> {
|
|
|
279
288
|
});
|
|
280
289
|
};
|
|
281
290
|
const groupsHere = [...new Set(wave.map((name) => groupOf.get(name)).filter((g): g is FanOutGroup => g !== undefined))];
|
|
282
|
-
|
|
283
|
-
|
|
291
|
+
// #4625: at most `parallelism` plans at once, members and groups alike.
|
|
292
|
+
const tasks: Array<() => Promise<WaveComponentPlan[]>> = [
|
|
284
293
|
...wave
|
|
285
294
|
.filter((name) => !groupOf.has(name))
|
|
286
|
-
.map(async (
|
|
295
|
+
.map((name) => async () => {
|
|
287
296
|
emit?.({ type: "step-start", component: name, phase: PR_PLAN_PHASE, step: "plan" });
|
|
288
297
|
const start = Date.now();
|
|
289
298
|
const p = await planWaveComponent(byName.get(name)!, options.registry, deployContext(options, name), outputs);
|
|
290
299
|
settle(name, start, p);
|
|
291
300
|
return [p];
|
|
292
301
|
}),
|
|
293
|
-
...groupsHere.map(async (
|
|
302
|
+
...groupsHere.map((group) => async () => {
|
|
294
303
|
for (const name of group.components) emit?.({ type: "step-start", component: name, phase: PR_PLAN_PHASE, step: "plan" });
|
|
295
304
|
const start = Date.now();
|
|
296
305
|
const g = await planComponentGroup({
|
|
@@ -307,8 +316,8 @@ export async function planPrSet(options: PrPlanSetOptions): Promise<PrPlanSet> {
|
|
|
307
316
|
groups.push({ ...group, digest: g.digest ?? null, ...(error !== undefined ? { error } : {}), ...(g.run ? { run: g.run } : {}) });
|
|
308
317
|
return g.plans;
|
|
309
318
|
}),
|
|
310
|
-
|
|
311
|
-
).flat();
|
|
319
|
+
];
|
|
320
|
+
const results = (await mapLimited(tasks, options.parallelism, (task) => task())).flat();
|
|
312
321
|
/** What each member of a group planned to expose, for its group-mates' reads. */
|
|
313
322
|
const plannedHere = new Map(results.map((p) => [p.component, "error" in p ? undefined : p.outputs?.known]));
|
|
314
323
|
for (const p of results) {
|
|
@@ -381,6 +390,7 @@ export async function planPrSet(options: PrPlanSetOptions): Promise<PrPlanSet> {
|
|
|
381
390
|
...(Object.keys(locations).length > 0 ? { locations } : {}),
|
|
382
391
|
...(Object.keys(deployedOutputs).length > 0 ? { deployedOutputs } : {}),
|
|
383
392
|
...(Object.keys(plannedOutputs).length > 0 ? { plannedOutputs } : {}),
|
|
393
|
+
...(options.targets && Object.keys(options.targets).length > 0 ? { targets: Object.fromEntries(Object.entries(options.targets).map(([c, a]) => [c, [...a]])) } : {}),
|
|
384
394
|
};
|
|
385
395
|
}
|
|
386
396
|
|
|
@@ -1248,6 +1258,7 @@ export function prReport(input: PrReportInput): PrReport {
|
|
|
1248
1258
|
...(input.resumed ? { resumed: { applied: [...input.resumed].sort() } } : {}),
|
|
1249
1259
|
...(input.set.deployedOutputs ? { deployedOutputs: input.set.deployedOutputs } : {}),
|
|
1250
1260
|
...(input.set.plannedOutputs ? { plannedOutputs: input.set.plannedOutputs } : {}),
|
|
1261
|
+
...(input.set.targets ? { narrowed: input.set.targets } : {}),
|
|
1251
1262
|
...(input.rounds && input.rounds.length > 0 ? { rounds: input.rounds } : {}),
|
|
1252
1263
|
...(input.migrations && input.migrations.length > 0 ? { migrations: input.migrations } : {}),
|
|
1253
1264
|
approval: input.approval,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stale job's descriptor (#4628): `prStaleJob` on the three forges, the
|
|
3
|
+
* note job's tip, and productPipelineJobs returning both. Written for the
|
|
4
|
+
* ci-products post-merge pass.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, test } from "vitest";
|
|
7
|
+
import { prLoopPostJob, prStaleJob } from "./pr-pipeline";
|
|
8
|
+
import { productPipelineJobs } from "./product-pipeline";
|
|
9
|
+
import { PLYWOOD } from "../__fixtures__/product-words";
|
|
10
|
+
|
|
11
|
+
describe("the stale job (#4628)", () => {
|
|
12
|
+
test("none without staleNotes", () => {
|
|
13
|
+
expect(prStaleJob("github", "prod", {})).toBeUndefined();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("GitHub and Forgejo read the pushed commit; GitLab the pipeline's", () => {
|
|
17
|
+
expect(prStaleJob("github", "prod", { staleNotes: true })).toEqual({ command: 'chant components pr-post --stale --tip "$TIP_SHA" --env prod --forge github', env: { TIP_SHA: "${{ github.sha }}", GITHUB_TOKEN: "${{ github.token }}" } });
|
|
18
|
+
expect(prStaleJob("forgejo", "prod", { staleNotes: true, branch: "trunk" }, "shop")!.command).toBe('chant components pr-post --stale --tip "$TIP_SHA" --env prod --forge forgejo --branch "trunk" --member shop');
|
|
19
|
+
expect(prStaleJob("gitlab", "prod", { staleNotes: true })!.env).toEqual({ TIP_SHA: "$CI_COMMIT_SHA" });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("the note job passes the tip only with staleNotes", () => {
|
|
23
|
+
expect(prLoopPostJob("github", "prod").command).not.toContain("--tip");
|
|
24
|
+
expect(prLoopPostJob("github", "prod", undefined, undefined, { staleNotes: true }).env.TIP_SHA).toBe("${{ github.event.pull_request.base.sha }}");
|
|
25
|
+
expect(prLoopPostJob("gitlab", "prod", undefined, undefined, { staleNotes: true }).command).toContain('--tip "$TIP_SHA"');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("productPipelineJobs returns the stale job in the product's bin, naming the preview comment", () => {
|
|
29
|
+
const words = { ...PLYWOOD, commands: { preview: "plan" as const } };
|
|
30
|
+
const jobs = productPipelineJobs("github", "prod", { words, staleNotes: true, previewComment: true });
|
|
31
|
+
expect(jobs.stale!.command).toBe('npx --no-install plywood components pr-post --stale --tip "$TIP_SHA" --env prod --forge github --preview-comment');
|
|
32
|
+
expect(jobs.post.command).toContain('--tip "$TIP_SHA"');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -34,11 +34,12 @@ import {
|
|
|
34
34
|
type CiProductWords,
|
|
35
35
|
type CiProductWordsInput,
|
|
36
36
|
} from "../ci-product-words";
|
|
37
|
-
import { prCommentLockJobs, prCommentPreviewJob, prLoopJobs, prLoopPostJob, withProductBin, type PrCommentLockJob, type PrCommentPreviewJob, type PrLoopJob, type PrLoopPipelineOptions } from "./pr-pipeline";
|
|
37
|
+
import { prCommentLockJobs, prCommentPreviewJob, prLoopJobs, prLoopPostJob, prLoopRunner, prStaleJob, withProductBin, type PrCommentLockJob, type PrCommentPreviewJob, type PrLoopJob, type PrLoopPipelineOptions } from "./pr-pipeline";
|
|
38
38
|
import type { DriverComponent } from "./driver";
|
|
39
39
|
import type { ScheduledOpSpec } from "../lexicon";
|
|
40
40
|
import type { CiRunner } from "../ci-jobs";
|
|
41
41
|
import { resolveAgentSpec, type OpAgentSpec } from "../ci-agent";
|
|
42
|
+
import type { CiResponses } from "../ci-respond";
|
|
42
43
|
|
|
43
44
|
/** Where the generator writes a product's waves spec, which chant reads at base (#4550). */
|
|
44
45
|
export const PRODUCT_WAVES_SPEC_DIR = ".chant/op-waves";
|
|
@@ -79,6 +80,19 @@ export interface ProductPipelineOptions extends Omit<PrLoopPipelineOptions, "wor
|
|
|
79
80
|
* the merge.
|
|
80
81
|
*/
|
|
81
82
|
componentWaves?: { components: readonly Pick<DriverComponent, "name" | "dependsOn">[]; waveGate?: string; base?: string };
|
|
83
|
+
/**
|
|
84
|
+
* The responses to pipeline events (#4629, `../ci-respond.ts`): a refused
|
|
85
|
+
* wave's diff and a failed apply's triage, on by default, and the
|
|
86
|
+
* description check, off by default. The apply jobs carry them as
|
|
87
|
+
* `CHANT_RESPOND`, the waves spec as its `respond`.
|
|
88
|
+
*/
|
|
89
|
+
respond?: CiResponses;
|
|
90
|
+
/**
|
|
91
|
+
* The decide service the description check asks (#4629): a
|
|
92
|
+
* `decide.backends` entry of chant.config at the target branch, and the
|
|
93
|
+
* pinned model. Needed with `respond.description: "check"`.
|
|
94
|
+
*/
|
|
95
|
+
decide?: { backend: string; model: string };
|
|
82
96
|
}
|
|
83
97
|
|
|
84
98
|
/** The jobs of one product pipeline. */
|
|
@@ -94,7 +108,7 @@ export interface ProductPipelineJobs {
|
|
|
94
108
|
* `chant/lifecycle` that sets `CHANT_CONTROL_DIR`, so the note marks the
|
|
95
109
|
* cross-stack edges.
|
|
96
110
|
*/
|
|
97
|
-
post: { command: string; env: Record<string, string>; control?: ControlNoteCheckout };
|
|
111
|
+
post: { command: string; env: Record<string, string>; control?: ControlNoteCheckout; runner?: CiRunner };
|
|
98
112
|
/** The record job, when no waves apply on merge. */
|
|
99
113
|
record?: PrLoopJob;
|
|
100
114
|
/** The apply before merge, answering the apply comment, with `applyBeforeMerge`. */
|
|
@@ -108,13 +122,20 @@ export interface ProductPipelineJobs {
|
|
|
108
122
|
* `/<product> lock` keeps the locks the plan took, `/<product> unlock`
|
|
109
123
|
* releases them. The forge lexicons render the same jobs.
|
|
110
124
|
*/
|
|
111
|
-
locks?: PrCommentLockJob
|
|
125
|
+
locks?: Array<PrCommentLockJob & { runner?: CiRunner }>;
|
|
112
126
|
/**
|
|
113
127
|
* The comment preview (#4620), with `previewComment`: `/<product> <plan
|
|
114
128
|
* word>` plans the pull request's head again with a read token, and the
|
|
115
129
|
* job after it posts the note. The forge lexicons render the same jobs.
|
|
116
130
|
*/
|
|
117
|
-
preview?: PrCommentPreviewJob;
|
|
131
|
+
preview?: PrCommentPreviewJob & { noteRunner?: CiRunner };
|
|
132
|
+
/**
|
|
133
|
+
* The stale marking (#4628), with `staleNotes`: the command and values of
|
|
134
|
+
* the job that runs on a push to the target branch and marks each open
|
|
135
|
+
* pull request's note posted against another commit stale. The forge
|
|
136
|
+
* lexicons render the same job, `stale-notes`.
|
|
137
|
+
*/
|
|
138
|
+
stale?: { command: string; env: Record<string, string>; runner?: CiRunner };
|
|
118
139
|
/**
|
|
119
140
|
* The agent (#4616), with `agent`: the comment it answers, `/<product>
|
|
120
141
|
* agent <ask>`, and the scheduled Op spec whose generated workflow runs
|
|
@@ -189,8 +210,13 @@ export function productPipelineJobs(forge: ForgeKind, env: string, options: Prod
|
|
|
189
210
|
const applyMode: CiProductApplyMode = options.words.applyMode === "before-merge" && options.applyBeforeMerge ? "before-merge" : built;
|
|
190
211
|
const words = assertProductWords({ ...options.words, applyMode }, { jobs });
|
|
191
212
|
const { waves: given, wavesSpecFile, member, agent: _agent, componentWaves, ...loop } = options;
|
|
213
|
+
const { respond } = options;
|
|
214
|
+
// #4629: the pull request loop puts the responses on the apply and note jobs, as `chant build --pr-loop --respond` does.
|
|
192
215
|
const prLoop: PrLoopPipelineOptions = { ...loop, words, gate: options.gate ?? words.prGate };
|
|
193
216
|
const [plan, apply, record] = prLoopJobs(forge, env, prLoop, member);
|
|
217
|
+
// #4625: the jobs with no stage of their own run on the default runner.
|
|
218
|
+
const runnerOfDefault = prLoopRunner(options, "default");
|
|
219
|
+
const defaultRunner: { runner?: CiRunner } = runnerOfDefault !== undefined ? { runner: runnerOfDefault } : {};
|
|
194
220
|
const comments: Partial<Record<CiProductCommand, string>> = {};
|
|
195
221
|
for (const c of jobs) {
|
|
196
222
|
const line = commentLine(words, c);
|
|
@@ -198,17 +224,20 @@ export function productPipelineJobs(forge: ForgeKind, env: string, options: Prod
|
|
|
198
224
|
}
|
|
199
225
|
// #4619: the loop's control target, else the waves spec's.
|
|
200
226
|
const controlTarget = options.control?.target ?? (given?.control ? opWavesControlTarget(given.control) : undefined);
|
|
227
|
+
const post = prLoopPostJob(forge, env, member, words, { ...(options.staleNotes ? { staleNotes: true } : {}), ...(respond ? { respond } : {}), ...(options.decide ? { decide: options.decide } : {}) });
|
|
201
228
|
const out: ProductPipelineJobs = {
|
|
202
229
|
words,
|
|
203
230
|
plan: plan!,
|
|
204
|
-
post: { ...
|
|
231
|
+
post: { ...post, ...(controlTarget ? { control: controlNoteCheckout(forge, controlTarget, words) } : {}), ...defaultRunner },
|
|
205
232
|
comments,
|
|
206
233
|
...(options.applyBeforeMerge ? { applyBeforeMerge: apply! } : {}),
|
|
207
234
|
};
|
|
208
235
|
const locks = prCommentLockJobs(forge, { locks: options.locks, words });
|
|
209
|
-
if (locks.length > 0) out.locks = locks;
|
|
236
|
+
if (locks.length > 0) out.locks = locks.map((job) => ({ ...job, ...defaultRunner }));
|
|
237
|
+
const stale = prStaleJob(forge, env, prLoop, member);
|
|
238
|
+
if (stale) out.stale = { ...stale, ...defaultRunner };
|
|
210
239
|
const preview = prCommentPreviewJob(forge, env, prLoop, member);
|
|
211
|
-
if (preview) out.preview = preview;
|
|
240
|
+
if (preview) out.preview = { ...preview, ...(defaultRunner.runner !== undefined ? { noteRunner: defaultRunner.runner } : {}) };
|
|
212
241
|
// #4616: the agent answers its comment from a workflow of its own, generated from this spec.
|
|
213
242
|
const agentComment = options.agent ? comments.agent : undefined;
|
|
214
243
|
if (options.agent && agentComment) {
|
|
@@ -221,7 +250,20 @@ export function productPipelineJobs(forge: ForgeKind, env: string, options: Prod
|
|
|
221
250
|
? componentWavesSpec(componentWaves.components, words, componentWaveSteps({ ...(words.bin ? { bin: words.bin } : {}), env, base: componentWaves.base ?? "HEAD^1", ...(member ? { member } : {}), op, gate: prLoop.gate }), { ...(componentWaves.waveGate ? { gate: componentWaves.waveGate } : {}) })
|
|
222
251
|
: undefined);
|
|
223
252
|
if (!spec) return { ...out, record: record! };
|
|
224
|
-
const
|
|
253
|
+
const wavesRespond = respond ? Object.fromEntries(Object.entries(respond).filter(([e]) => e !== "description")) : {};
|
|
254
|
+
// #4625: the waves run on the apply runner and with the plan's parallelism, unless the spec names its own.
|
|
255
|
+
const applyRunner = prLoopRunner(options, "apply");
|
|
256
|
+
const named = {
|
|
257
|
+
...productWavesSpec(
|
|
258
|
+
{
|
|
259
|
+
...spec,
|
|
260
|
+
...(spec.runner === undefined && applyRunner !== undefined ? { runner: applyRunner } : {}),
|
|
261
|
+
...(spec.parallelism === undefined && options.parallelism !== undefined && spec.step !== undefined ? { parallelism: options.parallelism } : {}),
|
|
262
|
+
},
|
|
263
|
+
words,
|
|
264
|
+
),
|
|
265
|
+
...(Object.keys(wavesRespond).length > 0 ? { respond: { ...(spec.respond ?? {}), ...wavesRespond } } : {}),
|
|
266
|
+
};
|
|
225
267
|
const specFile = wavesSpecFile ?? productWavesSpecFile(named.name);
|
|
226
268
|
return { ...out, waves: { spec: named, specFile, jobs: opWaveJobs(named, specFile, { bin: words.bin }) } };
|
|
227
269
|
}
|