@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { formatError } from "../format.js";
|
|
2
|
+
const USAGE = "chant e2e safe-run [--scan <dir>]... -- <command...>";
|
|
3
|
+
/** `chant e2e <word>` with a word that is not a verb. */
|
|
4
|
+
export async function runE2eUnknown(ctx) {
|
|
5
|
+
console.error(formatError({ message: `Unknown e2e command: ${ctx.args.path}`, hint: USAGE }));
|
|
6
|
+
return 2;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `chant e2e safe-run [--scan <dir>]... -- <command...>` (chant#4587, C1): the
|
|
10
|
+
* harness's no-real-cloud wrapper (`../../e2e-harness/safe-run.ts`) for a
|
|
11
|
+
* driver that is not TypeScript. Exit codes: the command's own code after a
|
|
12
|
+
* CLEAN scan, 3 when the scan rejects the run, 2 for a usage error or a
|
|
13
|
+
* refused environment.
|
|
14
|
+
*/
|
|
15
|
+
export async function runE2eSafeRun(ctx) {
|
|
16
|
+
const command = (ctx.args.positionals ?? []).slice(1);
|
|
17
|
+
if (command.length === 0) {
|
|
18
|
+
console.error(formatError({ message: "chant e2e safe-run needs a command after --", hint: USAGE }));
|
|
19
|
+
return 2;
|
|
20
|
+
}
|
|
21
|
+
const { runSafeRunCommand } = await import("../../e2e-harness/safe-run-cli.js");
|
|
22
|
+
return runSafeRunCommand({ command, scan: ctx.args.scanDirs ?? [] });
|
|
23
|
+
}
|
|
@@ -110,6 +110,11 @@ export interface Prepared {
|
|
|
110
110
|
hookPlace?: PrHookPlace;
|
|
111
111
|
/** `pr-plan --target` (#4620): the addresses each planned member's capability plan narrows to. */
|
|
112
112
|
targets?: Record<string, string[]>;
|
|
113
|
+
/** `pr-plan --parallelism <n>` (#4625): how many members of a wave plan at once. */
|
|
114
|
+
parallelism?: number;
|
|
115
|
+
/** `pr-plan --refresh` and `--target-dependents` (#4627). */
|
|
116
|
+
refresh?: boolean;
|
|
117
|
+
targetDependents?: boolean;
|
|
113
118
|
/**
|
|
114
119
|
* Set when `ci.branches` or `ci.labels` (#4292) leave the member out of this
|
|
115
120
|
* stage: why. The plan is then empty, so the stage reports `nothing`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/pr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMjF;AA4LD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC9E"}
|
package/dist/cli/handlers/pr.js
CHANGED
|
@@ -86,7 +86,7 @@ import { describePlanChanged, PR_APPLY_GATE, prApproveCommand, prApproveCommands
|
|
|
86
86
|
import { FORGE_KINDS, forgeFromEnv, forgePrincipalOf } from "../../pr-forge.js";
|
|
87
87
|
import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "../../plan-summary.js";
|
|
88
88
|
import { upsertPlanNote } from "../../pr-post.js";
|
|
89
|
-
import { activeProductWords, productContext } from "../../ci-product-words.js";
|
|
89
|
+
import { activeProductWords, commandWord, parseProductComment, productContext } from "../../ci-product-words.js";
|
|
90
90
|
import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli.js";
|
|
91
91
|
import { formatError, formatInfo, formatSuccess, formatWarning } from "../format.js";
|
|
92
92
|
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
@@ -97,9 +97,10 @@ import { GATED_EXIT_CODE, autoReleaseRun, recordAutoReleasesForRun } from "./run
|
|
|
97
97
|
import { appliedDigestOf } from "../../components/auto-release.js";
|
|
98
98
|
import { parseArgs } from "../parse-args.js";
|
|
99
99
|
import { withComponentEndpoint } from "../component-endpoint.js";
|
|
100
|
-
import { assertTargetsAccepted, failedRunExitCode } from "../../components/driver.js";
|
|
101
|
-
import { TargetsRefusedError } from "../../components/capability.js";
|
|
100
|
+
import { assertPlanFlagsAccepted, assertTargetsAccepted, failedRunExitCode } from "../../components/driver.js";
|
|
101
|
+
import { PLAN_FLAG_ARGS, PlanFlagRefusedError, TargetsRefusedError } from "../../components/capability.js";
|
|
102
102
|
import { prPlanTargets } from "../../components/pr-targets.js";
|
|
103
|
+
import { PREVIEW_COMMENT_ENV } from "../../components/pr-pipeline.js";
|
|
103
104
|
import { prLoopHooksAt, runPrHooks } from "../../components/pr-hooks.js";
|
|
104
105
|
import { decidePrPolicyOverride, policyReviewOf, prLoopPolicyAt, prPolicyReport, runPrPolicy, spendPrPolicyOverride } from "../../components/pr-policy.js";
|
|
105
106
|
import { lexiconNames } from "../../lexicon-module.js";
|
|
@@ -133,6 +134,10 @@ export async function prepare(ctx, stage) {
|
|
|
133
134
|
if (stage !== "plan" && args.targets && args.targets.length > 0) {
|
|
134
135
|
return fail(`pr-${stage} applies or records what the pull request's approved plan covers, so it takes no --target`, "Narrow the plan with pr-plan --target, and approve that plan.");
|
|
135
136
|
}
|
|
137
|
+
// #4627: refresh and target dependents change what the preview plans, as a target does.
|
|
138
|
+
if (stage !== "plan" && (args.refresh || args.targetDependents)) {
|
|
139
|
+
return fail(`pr-${stage} applies or records what the pull request's approved plan covers, so it takes no ${args.refresh ? "--refresh" : "--target-dependents"}`, "Plan with pr-plan --refresh or --target-dependents, and approve that plan.");
|
|
140
|
+
}
|
|
136
141
|
let member;
|
|
137
142
|
if (args.members?.length) {
|
|
138
143
|
const checked = await checkMember(projectPath, args.members);
|
|
@@ -419,8 +424,66 @@ export async function planBare(p, onRunEvent) {
|
|
|
419
424
|
policyBase: p.base,
|
|
420
425
|
...(onRunEvent ? { onRunEvent } : {}),
|
|
421
426
|
...(p.targets ? { targets: p.targets } : {}),
|
|
427
|
+
...(p.parallelism !== undefined ? { parallelism: p.parallelism } : {}),
|
|
428
|
+
...(p.refresh ? { refresh: true } : {}),
|
|
429
|
+
...(p.targetDependents ? { targetDependents: true } : {}),
|
|
422
430
|
});
|
|
423
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* `pr-plan --refresh` and `--target-dependents` (#4627), from the line or
|
|
434
|
+
* the preview comment: set on `p`, or the exit code when a planned member's
|
|
435
|
+
* capability cannot honour one, named before anything plans, as
|
|
436
|
+
* {@link narrowToTargets} does for targets. `--target-dependents` needs a
|
|
437
|
+
* target.
|
|
438
|
+
*/
|
|
439
|
+
function planWithFlags(p, flags) {
|
|
440
|
+
if (!flags.refresh && !flags.targetDependents)
|
|
441
|
+
return undefined;
|
|
442
|
+
if (flags.targetDependents && !p.targets)
|
|
443
|
+
return fail("--target-dependents widens a --target to what depends on it, and nothing was narrowed", "Give --target <address> with it.");
|
|
444
|
+
const byName = new Map(p.components.map((c) => [c.name, c]));
|
|
445
|
+
for (const name of p.plan.order) {
|
|
446
|
+
const component = byName.get(name);
|
|
447
|
+
if (!component)
|
|
448
|
+
continue;
|
|
449
|
+
try {
|
|
450
|
+
assertPlanFlagsAccepted(component, p.registry, { ...(flags.refresh ? { refresh: true } : {}), ...(flags.targetDependents && p.targets?.[name] ? { targetDependents: true } : {}) });
|
|
451
|
+
}
|
|
452
|
+
catch (err) {
|
|
453
|
+
if (err instanceof PlanFlagRefusedError)
|
|
454
|
+
return fail(`${err.message}, so nothing was planned`, `Drop ${PLAN_FLAG_ARGS[err.flag]}, or plan only members whose steps take it.`);
|
|
455
|
+
throw err;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (flags.refresh)
|
|
459
|
+
p.refresh = true;
|
|
460
|
+
if (flags.targetDependents)
|
|
461
|
+
p.targetDependents = true;
|
|
462
|
+
console.error(formatInfo(`planning with ${[flags.refresh ? "--refresh" : "", flags.targetDependents ? "--target-dependents" : ""].filter(Boolean).join(" and ")}`));
|
|
463
|
+
return undefined;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* `pr-plan --comment-targets` (#4626): the `--target` addresses of the
|
|
467
|
+
* preview comment in {@link PREVIEW_COMMENT_ENV}, read with the product's
|
|
468
|
+
* grammar, or the exit code when the comment is refused. No comment, or one
|
|
469
|
+
* with no target: none. The checks `--target` makes follow in
|
|
470
|
+
* {@link narrowToTargets}.
|
|
471
|
+
*/
|
|
472
|
+
function commentTargets(env = process.env) {
|
|
473
|
+
const body = env[PREVIEW_COMMENT_ENV];
|
|
474
|
+
if (body === undefined || body.trim() === "")
|
|
475
|
+
return { targets: [] };
|
|
476
|
+
const words = activeProductWords();
|
|
477
|
+
const parsed = parseProductComment(words, body, env);
|
|
478
|
+
if (parsed === undefined)
|
|
479
|
+
return { targets: [] };
|
|
480
|
+
if (parsed.kind === "refused")
|
|
481
|
+
return fail(`the preview comment is refused: ${parsed.reason}, so nothing was planned`, `/${words.product} ${commandWord(words, "plan") ?? "plan"} --target <address> narrows the preview to the address.`);
|
|
482
|
+
if (parsed.kind !== "plan")
|
|
483
|
+
return { targets: [] };
|
|
484
|
+
// #4627: the comment's --refresh and --target-dependents too.
|
|
485
|
+
return { targets: parsed.targets ?? [], ...(parsed.refresh ? { refresh: true } : {}), ...(parsed.targetDependents ? { targetDependents: true } : {}) };
|
|
486
|
+
}
|
|
424
487
|
/**
|
|
425
488
|
* `pr-plan --target` (#4620): the addresses by member, set on `p`, or the
|
|
426
489
|
* exit code when a value is refused or a targeted member has a capability
|
|
@@ -730,9 +793,18 @@ async function prPlan(ctx, stage) {
|
|
|
730
793
|
const p = await prepare(ctx, "plan");
|
|
731
794
|
if (typeof p === "number")
|
|
732
795
|
return p;
|
|
733
|
-
|
|
796
|
+
// #4626: the preview comment's --target addresses, read from the comment the job carries in a variable.
|
|
797
|
+
const fromComment = ctx.args.commentTargets ? commentTargets() : { targets: [] };
|
|
798
|
+
if (typeof fromComment === "number")
|
|
799
|
+
return fromComment;
|
|
800
|
+
const narrowed = narrowToTargets(p, [...(ctx.args.targets ?? []), ...fromComment.targets]);
|
|
734
801
|
if (narrowed !== undefined)
|
|
735
802
|
return narrowed;
|
|
803
|
+
const flagged = planWithFlags(p, { refresh: ctx.args.refresh === true || fromComment.refresh === true, targetDependents: ctx.args.targetDependents === true || fromComment.targetDependents === true });
|
|
804
|
+
if (flagged !== undefined)
|
|
805
|
+
return flagged;
|
|
806
|
+
if (ctx.args.parallelism !== undefined)
|
|
807
|
+
p.parallelism = ctx.args.parallelism;
|
|
736
808
|
const op = prOp(ctx.args.pr, p.member);
|
|
737
809
|
placeHooks(ctx, p, "plan", op);
|
|
738
810
|
const upload = openUpload(stage, "plan", ctx.args.pr, p);
|
|
@@ -879,6 +951,10 @@ export function runComponentsPrApply(ctx) {
|
|
|
879
951
|
let beforeMerge;
|
|
880
952
|
if (ctx.args.requires && !ctx.args.beforeMerge)
|
|
881
953
|
return fail("--requires names the checks of an apply before merge, so it needs --before-merge --pr <n>");
|
|
954
|
+
// #4636: the merge after the update, checked before anything applies.
|
|
955
|
+
const mergeProblem = await mergeArgsProblem(ctx.args);
|
|
956
|
+
if (mergeProblem)
|
|
957
|
+
return fail(mergeProblem);
|
|
882
958
|
if (ctx.args.beforeMerge) {
|
|
883
959
|
const checked = await beforeMergeChecks(ctx);
|
|
884
960
|
if (typeof checked === "number")
|
|
@@ -1198,8 +1274,71 @@ async function prApply(ctx, stage, beforeMerge) {
|
|
|
1198
1274
|
const code = await stop(report, exit, applied.run.status === "gated" ? "gated" : undefined);
|
|
1199
1275
|
if (applied.status === "applied" && !afterFailed)
|
|
1200
1276
|
console.error(formatSuccess(`applied the plan ${report.digest} approved by ${(approval.approvedBy ?? []).join(", ")}`));
|
|
1277
|
+
// #4636: an update before merge that applied every member merges the pull request, never the other way round.
|
|
1278
|
+
if (code === 0 && beforeMerge && pr !== null && args.merge === "auto" && applied.status === "applied" && !afterFailed)
|
|
1279
|
+
return mergeAfterUpdate(ctx, p, pr);
|
|
1201
1280
|
return code;
|
|
1202
1281
|
}
|
|
1282
|
+
/** `--merge`, `--merge-token-env` and `--merge-method` as one problem, or undefined when they hold together. */
|
|
1283
|
+
async function mergeArgsProblem(args) {
|
|
1284
|
+
const { PR_APPLY_MERGES, PR_MERGE_METHODS } = await import("../../pr-merge.js");
|
|
1285
|
+
if (args.merge === undefined) {
|
|
1286
|
+
if (args.mergeTokenEnv || args.mergeMethod)
|
|
1287
|
+
return "--merge-token-env and --merge-method go with --merge auto";
|
|
1288
|
+
return undefined;
|
|
1289
|
+
}
|
|
1290
|
+
if (!PR_APPLY_MERGES.includes(args.merge))
|
|
1291
|
+
return `--merge takes ${PR_APPLY_MERGES.join(" or ")}, not ${args.merge}`;
|
|
1292
|
+
if (args.merge === "manual")
|
|
1293
|
+
return args.mergeTokenEnv || args.mergeMethod ? "--merge manual leaves the merge to a person, so it takes no --merge-token-env or --merge-method" : undefined;
|
|
1294
|
+
if (!args.beforeMerge)
|
|
1295
|
+
return "--merge auto merges a pull request once its update before merge applied, so it needs --before-merge --pr <n>";
|
|
1296
|
+
if (!args.mergeTokenEnv)
|
|
1297
|
+
return "--merge auto merges with a token of its own, never the job's: --merge-token-env <VAR> (on GitLab a protected variable)";
|
|
1298
|
+
if (args.mergeMethod && !PR_MERGE_METHODS.includes(args.mergeMethod))
|
|
1299
|
+
return `--merge-method takes ${PR_MERGE_METHODS.join(", ")}, not ${args.mergeMethod}`;
|
|
1300
|
+
return undefined;
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* The merge after an update before merge applied (#4636): the apply's
|
|
1304
|
+
* records pushed to the ledger, the head checked again, then the forge's
|
|
1305
|
+
* merge with the token `--merge-token-env` names alone. A refusal is posted
|
|
1306
|
+
* on the pull request and exits as waiting (3); the update stays applied.
|
|
1307
|
+
*/
|
|
1308
|
+
async function mergeAfterUpdate(ctx, p, pr) {
|
|
1309
|
+
const { mergeAfterApply, mergeTokenEnv } = await import("../../pr-merge.js");
|
|
1310
|
+
const { pushLifecycleReport } = await import("../../lifecycle/git.js");
|
|
1311
|
+
const kind = p.forge?.kind ?? ctx.args.forge;
|
|
1312
|
+
if (!kind)
|
|
1313
|
+
return fail("--merge auto needs --forge <kind> to merge on");
|
|
1314
|
+
const env = mergeTokenEnv(ctx.args.mergeTokenEnv);
|
|
1315
|
+
if ("error" in env) {
|
|
1316
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${env.error}` }));
|
|
1317
|
+
return CHANT_EXIT.waiting;
|
|
1318
|
+
}
|
|
1319
|
+
let forge;
|
|
1320
|
+
try {
|
|
1321
|
+
forge = forgeFromEnv(kind, env);
|
|
1322
|
+
}
|
|
1323
|
+
catch (err) {
|
|
1324
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1325
|
+
return CHANT_EXIT.waiting;
|
|
1326
|
+
}
|
|
1327
|
+
const pushed = await pushLifecycleReport();
|
|
1328
|
+
const merged = await mergeAfterApply({
|
|
1329
|
+
forge,
|
|
1330
|
+
pr,
|
|
1331
|
+
head: p.head,
|
|
1332
|
+
...(ctx.args.mergeMethod ? { method: ctx.args.mergeMethod } : {}),
|
|
1333
|
+
recorded: { pushed: pushed.pushed, ...(pushed.pushWarning ? { warning: pushed.pushWarning } : {}) },
|
|
1334
|
+
});
|
|
1335
|
+
if (merged.merged) {
|
|
1336
|
+
console.error(formatSuccess(`merged ${kind === "gitlab" ? `!${pr}` : `#${pr}`} at ${p.head.slice(0, 12)}${merged.sha ? ` as ${merged.sha.slice(0, 12)}` : ""}`));
|
|
1337
|
+
return 0;
|
|
1338
|
+
}
|
|
1339
|
+
console.error(formatWarning({ message: `the pull request was not merged: ${merged.reason}${merged.posted ? "; the reason is posted on it" : ""}` }));
|
|
1340
|
+
return CHANT_EXIT.waiting;
|
|
1341
|
+
}
|
|
1203
1342
|
/**
|
|
1204
1343
|
* Under `ci.locks` (#4293): the refusal when another open pull request holds
|
|
1205
1344
|
* a lock on a component this apply reaches, else null. The targets are the
|
|
@@ -1559,6 +1698,9 @@ function stopper(ctx, p, events, upload) {
|
|
|
1559
1698
|
return async (report, code, settle) => {
|
|
1560
1699
|
events?.settle(settle ?? settleOf(report.status), report.status === "plan-failed" || report.status === "failed" ? report.message ?? `pr-${report.stage} ${report.status}` : undefined);
|
|
1561
1700
|
await finish(ctx, p, report, upload);
|
|
1701
|
+
// #4629: a failed apply's triage and a refused apply's diff, on the pull request.
|
|
1702
|
+
if (report.stage === "apply" && (report.status === "failed" || report.status === "refused") && !ctx.args.noStatus)
|
|
1703
|
+
await respondApply(ctx, p, report);
|
|
1562
1704
|
console.error((code === 0 ? formatInfo : (m) => formatWarning({ message: m }))(`pr-${report.stage}: ${report.status}${report.refusal ? ` (${report.refusal})` : ""}`));
|
|
1563
1705
|
if (report.message)
|
|
1564
1706
|
console.error(report.message);
|
|
@@ -1566,6 +1708,22 @@ function stopper(ctx, p, events, upload) {
|
|
|
1566
1708
|
return code;
|
|
1567
1709
|
};
|
|
1568
1710
|
}
|
|
1711
|
+
/** The responses an apply's report calls for (#4629), from `--respond` over `CHANT_RESPOND`. Never throws. */
|
|
1712
|
+
async function respondApply(ctx, p, report) {
|
|
1713
|
+
try {
|
|
1714
|
+
const { parseRespondList } = await import("../../ci-respond.js");
|
|
1715
|
+
const given = ctx.args.respond ? parseRespondList(ctx.args.respond) : {};
|
|
1716
|
+
if ("error" in given) {
|
|
1717
|
+
console.error(formatWarning({ message: `no response was posted: ${given.error}` }));
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
const { respondPrApply } = await import("../../ci-respond-run.js");
|
|
1721
|
+
await respondPrApply(p.forge, report, given);
|
|
1722
|
+
}
|
|
1723
|
+
catch (err) {
|
|
1724
|
+
console.error(formatWarning({ message: `the apply's responses were not posted: ${err instanceof Error ? err.message : String(err)}` }));
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1569
1727
|
/**
|
|
1570
1728
|
* The `--require-review` check (#3183, #4000) of an approval's approvers,
|
|
1571
1729
|
* `what` naming the plan they approved. The pull request's reviews and
|
|
@@ -2470,6 +2628,8 @@ function writeWaveChangeSet(ctx, wave, doc, upload) {
|
|
|
2470
2628
|
*/
|
|
2471
2629
|
export async function runComponentsPrPost(ctx) {
|
|
2472
2630
|
const { args } = ctx;
|
|
2631
|
+
if (args.stale)
|
|
2632
|
+
return runComponentsPrPostStale(ctx);
|
|
2473
2633
|
if (args.open)
|
|
2474
2634
|
return runComponentsPrPostOpen(ctx);
|
|
2475
2635
|
if (args.pr === undefined)
|
|
@@ -2491,6 +2651,9 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2491
2651
|
}
|
|
2492
2652
|
const { postPlanReport } = await import("../../pr-post.js");
|
|
2493
2653
|
const member = args.members?.[0];
|
|
2654
|
+
const description = await descriptionCheckOf(ctx, forge);
|
|
2655
|
+
if (typeof description === "number")
|
|
2656
|
+
return description;
|
|
2494
2657
|
const posted = await postPlanReport({
|
|
2495
2658
|
forge,
|
|
2496
2659
|
dir: resolve(args.output ?? PR_REPORT_DIR),
|
|
@@ -2501,6 +2664,10 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2501
2664
|
...(args.planResult ? { result: args.planResult } : {}),
|
|
2502
2665
|
// #4289: the plan job could not ask the forge, so the note job does, from the Ops at the commit it checked out.
|
|
2503
2666
|
overdue: () => overdueOps(forge, member),
|
|
2667
|
+
...(description ? { description } : {}),
|
|
2668
|
+
// #4628: the target branch's commit for the note's tip line, and the job summary where the forge keeps one.
|
|
2669
|
+
...(args.tip ? { baseTip: args.tip } : {}),
|
|
2670
|
+
...(args.forge !== "gitlab" && process.env.GITHUB_STEP_SUMMARY ? { summaryFile: process.env.GITHUB_STEP_SUMMARY } : {}),
|
|
2504
2671
|
});
|
|
2505
2672
|
for (const message of posted.warnings)
|
|
2506
2673
|
console.error(formatWarning({ message }));
|
|
@@ -2509,6 +2676,88 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2509
2676
|
console.error(formatInfo(`pr-post: ${prStatusContext("plan", member)} ${posted.state}: ${posted.description}${posted.noted ? "; note posted" : ""}`));
|
|
2510
2677
|
return 0;
|
|
2511
2678
|
}
|
|
2679
|
+
/**
|
|
2680
|
+
* The description check pr-post runs after the note (#4629), when the
|
|
2681
|
+
* responses turn it on (`--respond description=check`, or `CHANT_RESPOND`):
|
|
2682
|
+
* the `decide.backends` entry `--decide-backend` names, from chant.config
|
|
2683
|
+
* at the commit this job checked out (the target branch's, never the pull
|
|
2684
|
+
* request's), and the model `--decide-model` pins. On with no backend is
|
|
2685
|
+
* refused, so a pipeline that asks for the check learns it never ran.
|
|
2686
|
+
*/
|
|
2687
|
+
async function descriptionCheckOf(ctx, forge) {
|
|
2688
|
+
const { parseRespondList, resolveResponses } = await import("../../ci-respond.js");
|
|
2689
|
+
const given = ctx.args.respond ? parseRespondList(ctx.args.respond) : {};
|
|
2690
|
+
if ("error" in given)
|
|
2691
|
+
return fail(given.error);
|
|
2692
|
+
if (resolveResponses(given, process.env, (m) => console.error(formatWarning({ message: m }))).description !== "check")
|
|
2693
|
+
return undefined;
|
|
2694
|
+
const name = ctx.args.decideBackend;
|
|
2695
|
+
if (!name || !ctx.args.decideModel)
|
|
2696
|
+
return fail("the description check asks a decide service, so it needs --decide-backend <name> and --decide-model <id>", "Name a decide.backends entry of chant.config, or turn the check off: --respond description=off");
|
|
2697
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
2698
|
+
let backend;
|
|
2699
|
+
try {
|
|
2700
|
+
const loaded = await loadChantConfig(process.cwd());
|
|
2701
|
+
backend = loaded.config.decide?.backends?.[name];
|
|
2702
|
+
}
|
|
2703
|
+
catch (err) {
|
|
2704
|
+
return fail(`could not read decide.backends from chant.config: ${err instanceof Error ? err.message : String(err)}`);
|
|
2705
|
+
}
|
|
2706
|
+
if (!backend)
|
|
2707
|
+
return fail(`the description check names the backend ${name}, and chant.config has no decide.backends.${name}`);
|
|
2708
|
+
const { backendDescriptionAsk, respondDescription } = await import("../../ci-respond-run.js");
|
|
2709
|
+
const ask = backendDescriptionAsk(backend, { name, model: ctx.args.decideModel, cwd: process.cwd() });
|
|
2710
|
+
return async (report) => {
|
|
2711
|
+
await respondDescription(forge, report, { ask });
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
/**
|
|
2715
|
+
* `pr-post --stale --tip <sha> --env <env> --forge <kind> [--branch <branch>]
|
|
2716
|
+
* [--member <name>] [--preview-comment]` (#4628): after a push to the target
|
|
2717
|
+
* branch, mark each open pull request's note that was posted against
|
|
2718
|
+
* another commit stale, naming the comment that previews again with
|
|
2719
|
+
* `--preview-comment`, and set its plan status back to pending
|
|
2720
|
+
* (`markStaleNotes`, ../../pr-post.ts). The branch is `--branch`, else the
|
|
2721
|
+
* job's (`GITHUB_REF_NAME`, `CI_COMMIT_BRANCH`). It exits 0 once it has
|
|
2722
|
+
* marked, as `pr-post` does.
|
|
2723
|
+
*/
|
|
2724
|
+
async function runComponentsPrPostStale(ctx) {
|
|
2725
|
+
const { args } = ctx;
|
|
2726
|
+
if (args.pr !== undefined || args.head)
|
|
2727
|
+
return fail("pr-post --stale finds each open pull request and its head itself, so it takes no --pr or --head");
|
|
2728
|
+
if (!args.tip)
|
|
2729
|
+
return fail("pr-post --stale needs the target branch's commit now: --tip <sha>");
|
|
2730
|
+
if (!args.env)
|
|
2731
|
+
return fail("pr-post needs the environment the plan was for: --env <env>");
|
|
2732
|
+
if (!args.forge || !FORGE_KINDS.includes(args.forge))
|
|
2733
|
+
return fail(`pr-post posts to a forge: --forge ${FORGE_KINDS.join("|")}`);
|
|
2734
|
+
if (args.members && args.members.length > 1)
|
|
2735
|
+
return fail(`pr-post takes one --member, not ${args.members.join(", ")}`);
|
|
2736
|
+
const branch = args.branch ?? process.env.CI_COMMIT_BRANCH ?? process.env.GITHUB_REF_NAME;
|
|
2737
|
+
if (!branch)
|
|
2738
|
+
return fail("pr-post --stale marks the notes of the pull requests into a branch: run it in a job of a push, or pass --branch <branch>");
|
|
2739
|
+
let forge;
|
|
2740
|
+
try {
|
|
2741
|
+
forge = forgeFromEnv(args.forge);
|
|
2742
|
+
}
|
|
2743
|
+
catch (err) {
|
|
2744
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2745
|
+
}
|
|
2746
|
+
const member = args.members?.[0];
|
|
2747
|
+
const { markStaleNotes } = await import("../../pr-post.js");
|
|
2748
|
+
let done;
|
|
2749
|
+
try {
|
|
2750
|
+
done = await markStaleNotes({ forge, branch, tip: args.tip, env: args.env, ...(member ? { member } : {}), ...(args.previewComment ? { previewComment: true } : {}) });
|
|
2751
|
+
}
|
|
2752
|
+
catch (err) {
|
|
2753
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
2754
|
+
}
|
|
2755
|
+
for (const message of done.warnings)
|
|
2756
|
+
console.error(formatWarning({ message }));
|
|
2757
|
+
const marked = done.marks.filter((m) => m.marked).map((m) => `#${m.pr}`);
|
|
2758
|
+
console.error(formatInfo(`pr-post --stale: ${marked.length > 0 ? `marked ${marked.join(", ")} stale` : "no note to mark"} after ${branch} moved to ${args.tip.slice(0, 12)}`));
|
|
2759
|
+
return 0;
|
|
2760
|
+
}
|
|
2512
2761
|
/**
|
|
2513
2762
|
* `pr-post --open` (#4328): in a pipeline of the target branch on GitLab,
|
|
2514
2763
|
* post the plan note and status of every open merge request into it whose
|
|
@@ -2543,6 +2792,9 @@ async function runComponentsPrPostOpen(ctx) {
|
|
|
2543
2792
|
if (top.status !== 0)
|
|
2544
2793
|
return fail("pr-post --open reads the plan report's path from the repository root, and this directory is not in a git repository");
|
|
2545
2794
|
const member = args.members?.[0];
|
|
2795
|
+
const description = await descriptionCheckOf(ctx, forge);
|
|
2796
|
+
if (typeof description === "number")
|
|
2797
|
+
return description;
|
|
2546
2798
|
const artifactDir = relative(realpathSync(top.stdout.trim()), resolve(args.output ?? PR_REPORT_DIR)).split(sep).join("/");
|
|
2547
2799
|
const { postOpenPlanReports } = await import("../../pr-post.js");
|
|
2548
2800
|
const { gitlabPlanJobName } = await import("../../components/pr-pipeline.js");
|
|
@@ -2557,6 +2809,9 @@ async function runComponentsPrPostOpen(ctx) {
|
|
|
2557
2809
|
...(member ? { member } : {}),
|
|
2558
2810
|
// #4289: the Ops at the commit this pipeline checked out, the target branch's.
|
|
2559
2811
|
overdue: () => overdueOps(forge, member),
|
|
2812
|
+
...(description ? { description } : {}),
|
|
2813
|
+
// #4628: the target branch's commit this pipeline runs at, which each note's tip line names.
|
|
2814
|
+
...(args.tip ? { baseTip: args.tip } : {}),
|
|
2560
2815
|
});
|
|
2561
2816
|
}
|
|
2562
2817
|
catch (err) {
|
|
@@ -60,6 +60,8 @@ async function runOpWaveJobCommand(ctx) {
|
|
|
60
60
|
return 1;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
if (specFile && args.approvalStatus)
|
|
64
|
+
return runApprovalStatus(ctx, specFile);
|
|
63
65
|
if (specFile && args.wavesOutcome) {
|
|
64
66
|
// #4617: the outcome the control job's dispatch carries, from every wave job's outcome file.
|
|
65
67
|
try {
|
|
@@ -125,13 +127,99 @@ async function runOpWaveJobCommand(ctx) {
|
|
|
125
127
|
console.log(JSON.stringify(result, null, 2));
|
|
126
128
|
// #3761: tell people, when the spec says where. Delivery never changes the exit code.
|
|
127
129
|
await notifyOpWave(spec, args.wave, { result }, job);
|
|
130
|
+
// #4629: a refused wave's diff and a failed apply's triage, on the pull request or a tracking issue.
|
|
131
|
+
await respondWave(spec, args.wave, { result });
|
|
128
132
|
return result.exitCode;
|
|
129
133
|
}
|
|
130
134
|
catch (err) {
|
|
131
135
|
const message = err instanceof Error ? err.message : String(err);
|
|
132
136
|
console.error(formatError({ message }));
|
|
133
|
-
if (spec)
|
|
137
|
+
if (spec) {
|
|
134
138
|
await notifyOpWave(spec, args.wave, { error: message }, job);
|
|
139
|
+
await respondWave(spec, args.wave, { error: message });
|
|
140
|
+
}
|
|
135
141
|
return 1;
|
|
136
142
|
}
|
|
137
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The wave job's responses (#4629), through the forge the job's variables
|
|
146
|
+
* name. A job with no forge token posts nothing. Never throws.
|
|
147
|
+
*/
|
|
148
|
+
async function respondWave(spec, k, outcome) {
|
|
149
|
+
try {
|
|
150
|
+
const { respondOpWave, triageOfOpWave } = await import("../../ci-respond-run.js");
|
|
151
|
+
const { resolveResponses } = await import("../../ci-respond.js");
|
|
152
|
+
const responses = resolveResponses(spec.respond);
|
|
153
|
+
if (responses["wave-refused"] === "off" && responses["apply-failed"] === "off")
|
|
154
|
+
return;
|
|
155
|
+
if (outcome.result && outcome.result.exitCode === 0 && !triageOfOpWave(spec, k, outcome))
|
|
156
|
+
return;
|
|
157
|
+
const { detectForge, forgeFromEnv } = await import("../../pr-forge.js");
|
|
158
|
+
const kind = detectForge();
|
|
159
|
+
if (!kind)
|
|
160
|
+
return;
|
|
161
|
+
let forge;
|
|
162
|
+
try {
|
|
163
|
+
forge = forgeFromEnv(kind);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const head = process.env.GITHUB_SHA ?? process.env.CI_COMMIT_SHA;
|
|
169
|
+
await respondOpWave(spec, k, outcome, { forge, ...(head ? { head } : {}) });
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
console.error(formatWarning({ message: `the wave's responses were not posted: ${err instanceof Error ? err.message : String(err)}` }));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* `chant run wave --spec <file> --approval-status` (#4630): post
|
|
177
|
+
* `<product>/approval` on an open pull request's head, from its recorded
|
|
178
|
+
* plans and its reviews, or for a `pull-request` wave the pull request's
|
|
179
|
+
* own approval on the ledger. `--pr`, `--head` and `--base` name one pull
|
|
180
|
+
* request (GitHub and Forgejo); `--open` posts on every open one into
|
|
181
|
+
* `--branch` (GitLab's scheduled pipeline, or any forge by hand). It exits 0 once it posted, and
|
|
182
|
+
* 1 when it could not.
|
|
183
|
+
*/
|
|
184
|
+
async function runApprovalStatus(ctx, specFile) {
|
|
185
|
+
const { args } = ctx;
|
|
186
|
+
const fail = (message) => {
|
|
187
|
+
console.error(formatError({ message }));
|
|
188
|
+
return 1;
|
|
189
|
+
};
|
|
190
|
+
const { FORGE_KINDS, forgeFromEnv } = await import("../../pr-forge.js");
|
|
191
|
+
if (!args.forge || !FORGE_KINDS.includes(args.forge))
|
|
192
|
+
return fail(`--approval-status posts on a forge: --forge ${FORGE_KINDS.join("|")}`);
|
|
193
|
+
let spec;
|
|
194
|
+
let forge;
|
|
195
|
+
try {
|
|
196
|
+
spec = parseOpWavesSpec(readFileSync(resolve(specFile), "utf-8"), `--spec ${specFile}`);
|
|
197
|
+
forge = forgeFromEnv(args.forge);
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
201
|
+
}
|
|
202
|
+
const { postApprovalStatus, postOpenApprovalStatuses } = await import("../../op/approval-status.js");
|
|
203
|
+
const file = relative(process.cwd(), resolve(specFile));
|
|
204
|
+
try {
|
|
205
|
+
if (args.open) {
|
|
206
|
+
const branch = args.branch ?? process.env.CI_COMMIT_BRANCH;
|
|
207
|
+
if (!branch)
|
|
208
|
+
return fail("--approval-status --open posts for the pull requests into a branch: run it in a branch pipeline, or pass --branch <branch>");
|
|
209
|
+
const done = await postOpenApprovalStatuses({ spec, specFile: file, forge, branch });
|
|
210
|
+
for (const w of done.warnings)
|
|
211
|
+
console.error(formatWarning({ message: w }));
|
|
212
|
+
for (const p of done.posted)
|
|
213
|
+
console.error(`!${p.pr}: ${p.status.state}: ${p.status.description}`);
|
|
214
|
+
return done.warnings.length > 0 && done.posted.length === 0 ? 1 : 0;
|
|
215
|
+
}
|
|
216
|
+
if (args.pr === undefined || !args.head || !args.base)
|
|
217
|
+
return fail("--approval-status needs the pull request, its head and its base: --pr <n> --head <sha> --base <sha>, or --open");
|
|
218
|
+
const status = await postApprovalStatus({ spec, specFile: file, forge, pr: args.pr, head: args.head, base: args.base });
|
|
219
|
+
console.error(`#${args.pr}: ${status.state}: ${status.description}`);
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
return fail(`the approval status was not posted: ${err instanceof Error ? err.message : String(err)}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAEA,OAAO,EAAoB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAItG,OAAO,EAAkB,KAAK,UAAU,EAAmB,MAAM,YAAY,CAAC;AAa9E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAgB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAEA,OAAO,EAAoB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAItG,OAAO,EAAkB,KAAK,UAAU,EAAmB,MAAM,YAAY,CAAC;AAa9E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAgB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;AAumDzC;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,qBAAqB,EAAE,cAAc,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,2BAA2B,EAAE,eAAe,CAAA;CAAO,GAC7K,OAAO,CAAC,MAAM,CAAC,CAuCjB;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,EA8PvC,CAAC"}
|