@intentius/chant 0.124.108 → 0.124.110
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/__golden__/wave-loop/fan-out-applied.json +12 -6
- package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
- package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
- package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
- package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
- package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
- package/dist/agent-facts.d.ts +130 -0
- package/dist/agent-facts.js +196 -0
- package/dist/change-risk.d.ts +216 -0
- package/dist/change-risk.js +304 -0
- package/dist/change-set.d.ts +8 -0
- package/dist/ci-agent-alert.d.ts +139 -0
- package/dist/ci-agent-alert.js +342 -0
- package/dist/ci-agent-triggers.d.ts +152 -0
- package/dist/ci-agent-triggers.js +232 -0
- package/dist/ci-agent-verify-failed.d.ts +149 -0
- package/dist/ci-agent-verify-failed.js +191 -0
- package/dist/ci-agent.d.ts +136 -8
- package/dist/ci-agent.js +353 -26
- package/dist/ci-comment-commands.d.ts +8 -0
- package/dist/ci-comment-commands.js +17 -1
- package/dist/ci-comment-reject.d.ts +70 -0
- package/dist/ci-comment-reject.js +135 -0
- package/dist/ci-comment-replies.d.ts +3 -1
- package/dist/ci-comment-replies.js +6 -0
- package/dist/ci-estate/delivery.d.ts +25 -3
- package/dist/ci-estate/delivery.js +28 -9
- package/dist/ci-estate/page.d.ts +7 -3
- package/dist/ci-estate/page.js +19 -4
- package/dist/ci-estate/rows.d.ts +14 -2
- package/dist/ci-estate/rows.js +9 -1
- package/dist/ci-estate.d.ts +5 -2
- package/dist/ci-estate.js +3 -2
- package/dist/ci-handover.d.ts +2 -7
- package/dist/ci-handover.js +3 -20
- package/dist/ci-jobs.d.ts +6 -0
- package/dist/ci-jobs.js +17 -0
- package/dist/ci-note-commands.d.ts +2 -0
- package/dist/ci-note-commands.js +12 -1
- package/dist/ci-product-words.d.ts +151 -1
- package/dist/ci-product-words.js +1390 -3
- package/dist/ci-product.d.ts +100 -4
- package/dist/ci-product.js +99 -3
- package/dist/ci-respond-run.d.ts +9 -0
- package/dist/ci-respond-run.js +35 -4
- package/dist/ci-respond-summary-env.d.ts +56 -0
- package/dist/ci-respond-summary-env.js +81 -0
- package/dist/ci-respond-summary.d.ts +103 -0
- package/dist/ci-respond-summary.js +243 -0
- package/dist/ci-respond.d.ts +4 -2
- package/dist/ci-respond.js +4 -2
- package/dist/cli/command-group.js +1 -1
- package/dist/cli/commands/lint.js +21 -3
- package/dist/cli/handlers/agent.js +49 -4
- package/dist/cli/handlers/approve.js +3 -1
- package/dist/cli/handlers/build.d.ts +97 -1
- package/dist/cli/handlers/build.js +251 -3
- package/dist/cli/handlers/fan-out.js +55 -0
- package/dist/cli/handlers/graph.d.ts +14 -0
- package/dist/cli/handlers/graph.js +58 -3
- package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
- package/dist/cli/handlers/lifecycle-health.js +47 -9
- package/dist/cli/handlers/lifecycle.js +4 -1
- package/dist/cli/handlers/notify-relay.d.ts +2 -2
- package/dist/cli/handlers/notify-relay.js +67 -7
- package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
- package/dist/cli/handlers/pipeline-agent.js +255 -0
- package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
- package/dist/cli/handlers/pipeline-artifacts.js +203 -0
- package/dist/cli/handlers/pipeline.d.ts +16 -0
- package/dist/cli/handlers/pipeline.js +112 -0
- package/dist/cli/handlers/pr-comment.js +4 -0
- package/dist/cli/handlers/pr-notes.js +4 -1
- package/dist/cli/handlers/pr.d.ts +20 -0
- package/dist/cli/handlers/pr.js +114 -11
- package/dist/cli/handlers/promote.js +792 -47
- package/dist/cli/handlers/reject.d.ts +84 -0
- package/dist/cli/handlers/reject.js +216 -0
- package/dist/cli/handlers/release.js +4 -2
- package/dist/cli/handlers/replan.d.ts +54 -0
- package/dist/cli/handlers/replan.js +177 -0
- package/dist/cli/handlers/run-generate.d.ts +5 -0
- package/dist/cli/handlers/run-generate.js +31 -4
- package/dist/cli/handlers/run-wave.js +15 -2
- package/dist/cli/handlers/run.js +4 -2
- package/dist/cli/handlers/stage.d.ts +35 -0
- package/dist/cli/handlers/stage.js +90 -0
- package/dist/cli/lsp/server.js +4 -0
- package/dist/cli/main.js +88 -8
- package/dist/cli/parse-args.js +35 -2
- package/dist/cli/registry.d.ts +12 -0
- package/dist/components/auto-release.d.ts +2 -0
- package/dist/components/auto-release.js +1 -0
- package/dist/components/capability.d.ts +40 -0
- package/dist/components/cli-support.d.ts +21 -1
- package/dist/components/cli-support.js +28 -6
- package/dist/components/component.d.ts +23 -4
- package/dist/components/component.schema.json +28 -0
- package/dist/components/declared-reads.d.ts +44 -4
- package/dist/components/declared-reads.js +80 -3
- package/dist/components/discover.d.ts +8 -0
- package/dist/components/discover.js +1 -1
- package/dist/components/driver.d.ts +13 -0
- package/dist/components/driver.js +23 -2
- package/dist/components/environment-sets.d.ts +229 -0
- package/dist/components/environment-sets.js +338 -0
- package/dist/components/fan-out-canary.d.ts +47 -0
- package/dist/components/fan-out-canary.js +58 -0
- package/dist/components/fan-out-run.d.ts +17 -0
- package/dist/components/fan-out-run.js +14 -1
- package/dist/components/fan-out-support.d.ts +7 -0
- package/dist/components/fan-out-support.js +1 -1
- package/dist/components/groups.d.ts +8 -1
- package/dist/components/groups.js +19 -1
- package/dist/components/index.d.ts +5 -2
- package/dist/components/index.js +4 -1
- package/dist/components/pr-cost.d.ts +28 -0
- package/dist/components/pr-cost.js +53 -0
- package/dist/components/pr-pipeline.d.ts +33 -0
- package/dist/components/pr-pipeline.js +32 -5
- package/dist/components/pr-policy.d.ts +33 -2
- package/dist/components/pr-policy.js +5 -2
- package/dist/components/pr-risk.d.ts +42 -0
- package/dist/components/pr-risk.js +74 -0
- package/dist/components/product-pipeline.d.ts +43 -0
- package/dist/components/product-pipeline.js +67 -1
- package/dist/components/promote.d.ts +6 -0
- package/dist/components/promote.js +13 -0
- package/dist/components/release-compile.js +3 -1
- package/dist/components/release-gate.d.ts +6 -1
- package/dist/components/release-gate.js +10 -2
- package/dist/components/step-environments.d.ts +236 -0
- package/dist/components/step-environments.js +392 -0
- package/dist/components/upstream-replan.d.ts +201 -0
- package/dist/components/upstream-replan.js +249 -0
- package/dist/components/verify-step.d.ts +30 -0
- package/dist/components/verify-step.js +27 -0
- package/dist/components/wave-plan.js +6 -2
- package/dist/config-environments.d.ts +4 -2
- package/dist/control/dispatch.d.ts +15 -0
- package/dist/control/dispatch.js +28 -4
- package/dist/cost-estimate.d.ts +188 -0
- package/dist/cost-estimate.js +363 -0
- package/dist/drift-record.d.ts +36 -0
- package/dist/drift-record.js +44 -0
- package/dist/engine-facts.d.ts +105 -0
- package/dist/engine-facts.js +111 -0
- package/dist/exit-codes.d.ts +4 -3
- package/dist/exit-codes.js +4 -3
- package/dist/flag-params.d.ts +2 -2
- package/dist/flag-params.js +9 -4
- package/dist/floor-table.data.js +53 -0
- package/dist/forge-token-vars.d.ts +12 -0
- package/dist/forge-token-vars.js +25 -0
- package/dist/gate-decision.d.ts +3 -1
- package/dist/gate-decision.js +3 -1
- package/dist/gated-waves.d.ts +2 -0
- package/dist/gated-waves.js +1 -0
- package/dist/graph-ir.d.ts +30 -0
- package/dist/graph-ir.js +33 -1
- package/dist/graph-refs.d.ts +26 -0
- package/dist/graph-refs.js +34 -3
- package/dist/graph-schema/graph.schema.json +136 -0
- package/dist/health.d.ts +65 -0
- package/dist/health.js +62 -0
- package/dist/lexicon.d.ts +188 -1
- package/dist/lifecycle/disruption.d.ts +14 -1
- package/dist/lifecycle/disruption.js +5 -1
- package/dist/lifecycle/gate-change-set.d.ts +8 -0
- package/dist/lifecycle/gate-change-set.js +2 -1
- package/dist/lifecycle/gate-ledger.d.ts +26 -0
- package/dist/lifecycle/gate-rejection.d.ts +82 -0
- package/dist/lifecycle/gate-rejection.js +93 -0
- package/dist/lifecycle/gate-seal.d.ts +3 -3
- package/dist/lifecycle/gate-seal.js +5 -5
- package/dist/lifecycle/observe.d.ts +17 -0
- package/dist/lifecycle/observe.js +10 -1
- package/dist/lifecycle/release-cut.js +4 -0
- package/dist/lifecycle/release-ledger.d.ts +8 -0
- package/dist/lifecycle/release-risk.d.ts +137 -0
- package/dist/lifecycle/release-risk.js +214 -0
- package/dist/lifecycle/release-store.d.ts +9 -0
- package/dist/lifecycle/release-store.js +4 -0
- package/dist/lifecycle/stage-log.d.ts +85 -0
- package/dist/lifecycle/stage-log.js +141 -0
- package/dist/lint/canary-checks.d.ts +31 -0
- package/dist/lint/canary-checks.js +45 -0
- package/dist/lint/rule.d.ts +1 -0
- package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
- package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
- package/dist/lint/rules/index.d.ts +1 -0
- package/dist/lint/rules/index.js +3 -0
- package/dist/notify-relay-repo.d.ts +54 -0
- package/dist/notify-relay-repo.js +84 -0
- package/dist/notify-relay.d.ts +53 -3
- package/dist/notify-relay.js +96 -3
- package/dist/notify.d.ts +57 -1
- package/dist/notify.js +7 -1
- package/dist/notify.schema.json +61 -3
- package/dist/observation.d.ts +34 -0
- package/dist/observation.js +14 -1
- package/dist/op/activities/review-agent.d.ts +39 -2
- package/dist/op/activities/review-agent.js +88 -5
- package/dist/op/agent-permit.d.ts +88 -0
- package/dist/op/agent-permit.js +97 -0
- package/dist/op/gate-approval-base.d.ts +8 -0
- package/dist/op/gate-approval-base.js +9 -0
- package/dist/op/gate-approval.d.ts +30 -1
- package/dist/op/gate-approval.js +23 -2
- package/dist/op/gate-quorum.d.ts +114 -8
- package/dist/op/gate-quorum.js +198 -21
- package/dist/op/gate-reject.d.ts +79 -0
- package/dist/op/gate-reject.js +96 -0
- package/dist/op/gate-summary.js +1 -1
- package/dist/op/gate.d.ts +28 -3
- package/dist/op/gate.js +55 -13
- package/dist/op/generate-pipeline.d.ts +15 -1
- package/dist/op/generate-pipeline.js +32 -5
- package/dist/op/index.d.ts +11 -6
- package/dist/op/index.js +10 -5
- package/dist/op/local-executor.d.ts +2 -0
- package/dist/op/local-executor.js +23 -4
- package/dist/op/op-waves-after-plan.d.ts +23 -0
- package/dist/op/op-waves-after-plan.js +12 -1
- package/dist/op/op-waves-capability-spec.d.ts +14 -0
- package/dist/op/op-waves-capability-spec.js +46 -6
- package/dist/op/op-waves-capability.d.ts +21 -13
- package/dist/op/op-waves-capability.js +22 -59
- package/dist/op/op-waves-environment-sets.d.ts +41 -0
- package/dist/op/op-waves-environment-sets.js +82 -0
- package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
- package/dist/op/op-waves-quorum-warnings.js +90 -0
- package/dist/op/op-waves-release-port.d.ts +7 -0
- package/dist/op/op-waves-release-port.js +15 -3
- package/dist/op/op-waves-release.d.ts +15 -0
- package/dist/op/op-waves-release.js +15 -0
- package/dist/op/op-waves-run.d.ts +37 -3
- package/dist/op/op-waves-run.js +141 -18
- package/dist/op/op-waves-soak.d.ts +57 -0
- package/dist/op/op-waves-soak.js +111 -0
- package/dist/op/op-waves-split.d.ts +4 -0
- package/dist/op/op-waves-split.js +4 -0
- package/dist/op/op-waves.d.ts +67 -4
- package/dist/op/op-waves.js +71 -3
- package/dist/pipeline/agent-ajv.d.ts +4 -0
- package/dist/pipeline/agent-ajv.js +14 -0
- package/dist/pipeline/agent-steps.d.ts +329 -0
- package/dist/pipeline/agent-steps.js +602 -0
- package/dist/pipeline/artifacts.d.ts +264 -0
- package/dist/pipeline/artifacts.js +425 -0
- package/dist/pipeline/diff.d.ts +45 -0
- package/dist/pipeline/diff.js +177 -0
- package/dist/pipeline/fold.d.ts +43 -0
- package/dist/pipeline/fold.js +140 -0
- package/dist/pipeline/generate.d.ts +52 -0
- package/dist/pipeline/generate.js +120 -0
- package/dist/pipeline/product.d.ts +225 -0
- package/dist/pipeline/product.js +257 -0
- package/dist/pipeline/promote.d.ts +404 -0
- package/dist/pipeline/promote.js +694 -0
- package/dist/pipeline/read.d.ts +37 -0
- package/dist/pipeline/read.js +58 -0
- package/dist/pipeline/rendered.d.ts +25 -0
- package/dist/pipeline/rendered.js +53 -0
- package/dist/pipeline/soak-checks.d.ts +80 -0
- package/dist/pipeline/soak-checks.js +254 -0
- package/dist/pipeline/soak-gate.d.ts +97 -0
- package/dist/pipeline/soak-gate.js +176 -0
- package/dist/pipeline/soak-sources.d.ts +17 -0
- package/dist/pipeline/soak-sources.js +42 -0
- package/dist/pipeline/soak.d.ts +260 -0
- package/dist/pipeline/soak.js +378 -0
- package/dist/pipeline/spec.d.ts +724 -0
- package/dist/pipeline/spec.js +567 -0
- package/dist/pipeline/stage-ledger.d.ts +187 -0
- package/dist/pipeline/stage-ledger.js +185 -0
- package/dist/pipeline/stage-waves.d.ts +114 -0
- package/dist/pipeline/stage-waves.js +161 -0
- package/dist/pipeline/stages.d.ts +64 -0
- package/dist/pipeline/stages.js +174 -0
- package/dist/pipeline/verify-rollback.d.ts +277 -0
- package/dist/pipeline/verify-rollback.js +393 -0
- package/dist/pipeline.d.ts +142 -0
- package/dist/pipeline.js +143 -0
- package/dist/pr-loop.d.ts +22 -0
- package/dist/pr-loop.js +8 -0
- package/dist/pr-plan-note.d.ts +15 -1
- package/dist/pr-plan-note.js +8 -0
- package/dist/pr-post.d.ts +31 -0
- package/dist/pr-post.js +89 -0
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/report-store/audit.schema.json +50 -0
- package/dist/report-store/dora.schema.json +331 -0
- package/dist/report-store/estate.schema.json +96 -0
- package/dist/report-store/run.schema.json +14 -0
- package/dist/report-store.d.ts +151 -0
- package/dist/report-store.js +344 -0
- package/dist/run-event.d.ts +7 -2
- package/dist/wave-runtime.mjs +458 -404
- package/dist/workspace/catalog-edges.js +3 -3
- package/dist/workspace/change-set.schema.json +4 -0
- package/dist/workspace/ci-cloud-identity.d.ts +4 -0
- package/dist/workspace/ci-cloud-identity.js +30 -0
- package/dist/workspace/ci-run.js +17 -2
- package/dist/workspace/ci-secrets.d.ts +3 -1
- package/dist/workspace/ci-secrets.js +7 -1
- package/dist/workspace/compose-graph.d.ts +1 -1
- package/dist/workspace/compose-graph.js +3 -1
- package/dist/workspace/declaration.d.ts +27 -0
- package/dist/workspace/declaration.js +35 -0
- package/dist/workspace/declaration.schema.json +56 -0
- package/dist/workspace/graph-cli.js +26 -0
- package/dist/workspace/graph.schema.json +5 -1
- package/dist/workspace/identity-gate-rule.d.ts +4 -0
- package/dist/workspace/identity-gate-rule.js +2 -2
- package/dist/workspace/identity-reject-rule.d.ts +14 -0
- package/dist/workspace/identity-reject-rule.js +24 -0
- package/dist/workspace/identity.d.ts +3 -0
- package/dist/workspace/identity.js +2 -1
- package/dist/workspace/nested-graph.js +2 -0
- package/dist/workspace/pr-report.schema.json +65 -0
- package/dist/workspace/promotion-order.d.ts +19 -4
- package/dist/workspace/promotion-order.js +26 -4
- package/dist/workspace/release-train.d.ts +14 -0
- package/dist/workspace/release-train.js +32 -0
- package/dist/workspace/run-event.schema.json +2 -2
- package/dist/workspace/stack-read-edges.d.ts +19 -0
- package/dist/workspace/stack-read-edges.js +54 -0
- package/dist/workspace/status-gates.d.ts +51 -1
- package/dist/workspace/status-gates.js +60 -0
- package/dist/workspace/status-stages.d.ts +223 -0
- package/dist/workspace/status-stages.js +279 -0
- package/dist/workspace/status.d.ts +45 -1
- package/dist/workspace/status.js +109 -5
- package/dist/workspace/status.schema.json +283 -2
- package/dist/workspace/train-cut.js +5 -2
- package/dist/workspace/train-shell.d.ts +18 -0
- package/dist/workspace/train-shell.js +43 -0
- package/dist/workspace/trust/seal.d.ts +7 -0
- package/dist/workspace/trust/seal.js +9 -0
- package/package.json +5 -1
|
@@ -1,11 +1,69 @@
|
|
|
1
1
|
import type { CommandContext } from "../registry.js";
|
|
2
|
+
import type { PrLoopPipelineOptions } from "../../components/pr-pipeline.js";
|
|
3
|
+
import { type AgentFactsOption } from "../../ci-agent-triggers.js";
|
|
4
|
+
import { type WaveSummarySpec } from "../../ci-respond-summary-env.js";
|
|
5
|
+
/**
|
|
6
|
+
* The `prLoop` generator option from `--pr-loop`'s flags (#3183): the gate
|
|
7
|
+
* and the branch, and with `--events-json` and `--report-url` (#4007) the
|
|
8
|
+
* flags the generated jobs pass to pr-plan and pr-apply. `--pr-build` and
|
|
9
|
+
* `--pr-build-command` (#4088) add the build and lint steps before both.
|
|
10
|
+
* `reportUrl` is `--report-url`, else the workspace's `ci.reportUrl` (#4160).
|
|
11
|
+
* `requireReview` is `--require-review`, or a workspace that opts into the
|
|
12
|
+
* `review-rules` security group (#4168); off otherwise. `requireRunnerStart`
|
|
13
|
+
* is `--require-runner-start`, or the `isolated-runners` group. `--apply-on-merge`
|
|
14
|
+
* (#4168) writes the apply job on merge in place of the record job.
|
|
15
|
+
* `--pr-env` (#4298) adds the jobs of a pull request's environment.
|
|
16
|
+
* `--apply-before-merge` (#4301) writes the apply job that applies an open
|
|
17
|
+
* pull request before it merges, beside the record job.
|
|
18
|
+
* `--note-commands` (#4785) writes GitLab's scheduled job that answers the
|
|
19
|
+
* product's comment commands by polling the merge requests' notes.
|
|
20
|
+
* `--preview-comment` (#4620) writes the jobs that answer the product's plan
|
|
21
|
+
* comment with a preview of the pull request's head. `--action-job` (#4654)
|
|
22
|
+
* writes the job that answers the product's action comment and a dispatch
|
|
23
|
+
* with a member and an action.
|
|
24
|
+
* `--pr-runner`, `--pr-variable`, `--pr-secret` and `--parallelism` (#4625)
|
|
25
|
+
* set each stage's runner, the plan and apply jobs' variables and passed
|
|
26
|
+
* secrets, and how many members the plan plans at once.
|
|
27
|
+
* `--merge auto --merge-token-env <VAR> [--merge-method <m>]` (#4636) merges
|
|
28
|
+
* the pull request after its update before merge. `--respond <list>`,
|
|
29
|
+
* `--decide-backend` and `--decide-model` (#4629) set the apply and note
|
|
30
|
+
* jobs' responses and the description check's service.
|
|
31
|
+
* `--evidence-runner-key-secret <NAME>`, or `--evidence-identity oidc` with
|
|
32
|
+
* `--evidence-audience` (#4935), give the loop its runner identity: the note
|
|
33
|
+
* job signs `plan` and `policy`. `--check-job` and `--ref-gate-status`
|
|
34
|
+
* (#4935) write the check job and the ref gate's status job. {@link prLoopFlagsProblem}
|
|
35
|
+
* has checked all of them first.
|
|
36
|
+
*/
|
|
37
|
+
export declare function prLoopOption(args: CommandContext["args"], reportUrl: string | undefined, requireReview?: boolean, requireRunnerStart?: boolean): PrLoopPipelineOptions;
|
|
2
38
|
/**
|
|
3
39
|
* Why the pull request loop's merge, respond, decide and plan flags (#4636,
|
|
4
40
|
* #4629, #4627) do not hold together on `chant build`, or undefined when
|
|
5
41
|
* they do. Each value is refused by name, as `pr-apply` and `pr-post` refuse
|
|
6
42
|
* it, so a build never writes a job that fails on its own line.
|
|
7
43
|
*/
|
|
8
|
-
export declare function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" | "applyBeforeMerge" | "merge" | "mergeTokenEnv" | "mergeMethod" | "respond" | "decideBackend" | "decideModel" | "targetDependents"> & Partial<Pick<CommandContext["args"], "controlRepo" | "controlSettings" | "evidenceRunnerKeySecret" | "evidenceIdentity" | "evidenceAudience" | "checkJob" | "refGateStatus">>): string | undefined;
|
|
44
|
+
export declare function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" | "applyBeforeMerge" | "merge" | "mergeTokenEnv" | "mergeMethod" | "respond" | "decideBackend" | "decideModel" | "targetDependents"> & Partial<Pick<CommandContext["args"], "waveSummary" | "agentFactsTriggers" | "agentFactsKeyEnv" | "controlRepo" | "controlSettings" | "evidenceRunnerKeySecret" | "evidenceIdentity" | "evidenceAudience" | "checkJob" | "refGateStatus">>): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The refused-wave summary's settings of `--wave-summary <field>=<value>`
|
|
47
|
+
* (#5399), with the numeric fields as numbers, or the reason they are not
|
|
48
|
+
* settings. The fields are those of {@link WaveSummarySpec}.
|
|
49
|
+
*/
|
|
50
|
+
export declare function waveSummaryFromFlags(flags: Record<string, string>): {
|
|
51
|
+
spec: WaveSummarySpec;
|
|
52
|
+
} | {
|
|
53
|
+
error: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The agent facts of `--agent-facts` and `--agent-facts-key-env` (#5399), or
|
|
57
|
+
* the reason they are not settings.
|
|
58
|
+
*/
|
|
59
|
+
export declare function agentFactsFromFlags(args: {
|
|
60
|
+
agentFactsTriggers?: string[];
|
|
61
|
+
agentFactsKeyEnv?: string;
|
|
62
|
+
}): {
|
|
63
|
+
facts?: AgentFactsOption;
|
|
64
|
+
} | {
|
|
65
|
+
error: string;
|
|
66
|
+
};
|
|
9
67
|
/**
|
|
10
68
|
* The directory `chant build` builds (#4794). A path argument wins. With
|
|
11
69
|
* none, at the root of a project, it is the one source-dir rule's
|
|
@@ -14,4 +72,42 @@ export declare function prLoopFlagsProblem(args: Pick<CommandContext["args"], "p
|
|
|
14
72
|
* relative, so the paths the build prints read as before.
|
|
15
73
|
*/
|
|
16
74
|
export declare function buildPathOf(args: Pick<CommandContext["args"], "path" | "pathGiven">): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* The build's refusals of `onVerifyFail: "rollback"` (#5328): each step the
|
|
77
|
+
* member's stages apply (its components' deploy steps, build and publish
|
|
78
|
+
* steps left out, and the pipeline's `defaults.step`) read against its
|
|
79
|
+
* capability by `verifyRollbackProblems`. Empty when no stage sets it, and
|
|
80
|
+
* then nothing is loaded.
|
|
81
|
+
*/
|
|
82
|
+
export declare function verifyRollbackBuildProblems(dir: string, spec: import("../../pipeline/spec.js").PipelineSpec): Promise<string[]>;
|
|
83
|
+
/**
|
|
84
|
+
* The build's refusals of gate steps that name an environment the member
|
|
85
|
+
* does not declare (#5401). The member declares the `environments` of its
|
|
86
|
+
* `chant.config.ts`, its pipeline's stages, and each component's own
|
|
87
|
+
* `environments`. Components are loaded only when a component file mentions
|
|
88
|
+
* `environments`, so a member whose gates name none builds as before; a
|
|
89
|
+
* component that fails to load is left to `chant lint` and the run.
|
|
90
|
+
*/
|
|
91
|
+
export declare function gateEnvironmentBuildProblems(path: string): Promise<string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* The build's findings for `identity.gates.<gate>.agentPassesAlone` (#5388),
|
|
94
|
+
* from the declaration of the workspace holding `path`. `stages` refuses the
|
|
95
|
+
* key on an entry naming one of those stages' gates; with `opsDir`, the Ops
|
|
96
|
+
* built there are read for the warnings. Undefined outside a workspace, or
|
|
97
|
+
* when the declaration does not read: the build reports that elsewhere.
|
|
98
|
+
*/
|
|
99
|
+
export declare function agentPermitBuildCheck(path: string, options: {
|
|
100
|
+
stages?: readonly {
|
|
101
|
+
name: string;
|
|
102
|
+
}[];
|
|
103
|
+
opsDir?: string;
|
|
104
|
+
}): Promise<import("../../op/agent-permit.js").AgentPermitFindings | undefined>;
|
|
105
|
+
/**
|
|
106
|
+
* Fold the member's `.chant/pipeline.ts` (#5324) and write the spec to
|
|
107
|
+
* `.chant/pipeline.json`. The member is the project the build path belongs
|
|
108
|
+
* to. A file outside the subset fails the build with its finding; it is
|
|
109
|
+
* never run. Returns the exit code of a refusal already printed, or
|
|
110
|
+
* undefined when the build goes on.
|
|
111
|
+
*/
|
|
112
|
+
export declare function foldMemberPipeline(path: string): Promise<number | undefined>;
|
|
17
113
|
export declare function runBuild(ctx: CommandContext): Promise<number>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFileSync, mkdirSync } from "node:fs";
|
|
2
2
|
import { dirname, join, relative, resolve } from "node:path";
|
|
3
3
|
import { buildCommand, buildCommandWatch, printErrors, printWarnings, resolveBuildFormat } from "../commands/build.js";
|
|
4
|
-
import { formatError, formatInfo, formatSuccess, formatBold } from "../format.js";
|
|
4
|
+
import { formatError, formatInfo, formatSuccess, formatBold, formatWarning } from "../format.js";
|
|
5
5
|
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
6
6
|
import { generateComponentsPipeline } from "../../components/cli-support.js";
|
|
7
7
|
import { loadChantConfigUpward, resolveSourceDir } from "../../config.js";
|
|
@@ -11,6 +11,8 @@ import { resolvePromotionSource } from "../../components/promote-order.js";
|
|
|
11
11
|
import { activeProductWords, isChantWords } from "../../ci-product-words.js";
|
|
12
12
|
import { PR_APPLY_MERGES, PR_MERGE_METHODS } from "../../pr-merge.js";
|
|
13
13
|
import { parseRespondList } from "../../ci-respond.js";
|
|
14
|
+
import { AGENT_FACTS_TRIGGERS } from "../../ci-agent-triggers.js";
|
|
15
|
+
import { waveSummarySpecProblem } from "../../ci-respond-summary-env.js";
|
|
14
16
|
/**
|
|
15
17
|
* The engine install lines the project's lexicons give (#4550,
|
|
16
18
|
* `LexiconPlugin.ciSetup`), for the default image. A lexicon that cannot
|
|
@@ -70,7 +72,7 @@ async function engineSetupFor(path) {
|
|
|
70
72
|
* (#4935) write the check job and the ref gate's status job. {@link prLoopFlagsProblem}
|
|
71
73
|
* has checked all of them first.
|
|
72
74
|
*/
|
|
73
|
-
function prLoopOption(args, reportUrl, requireReview = false, requireRunnerStart = false) {
|
|
75
|
+
export function prLoopOption(args, reportUrl, requireReview = false, requireRunnerStart = false) {
|
|
74
76
|
const respond = args.respond ? parseRespondList(args.respond) : undefined;
|
|
75
77
|
// #4550: a product's bin set its words; the generated jobs answer its comment and run its bin.
|
|
76
78
|
const words = activeProductWords();
|
|
@@ -106,6 +108,10 @@ function prLoopOption(args, reportUrl, requireReview = false, requireRunnerStart
|
|
|
106
108
|
...(args.merge === "auto" && args.mergeTokenEnv ? { applyMerge: { tokenEnv: args.mergeTokenEnv, ...(args.mergeMethod ? { method: args.mergeMethod } : {}) } } : {}),
|
|
107
109
|
// #4629: the responses on the apply and note jobs, and the description check's service.
|
|
108
110
|
...(respond && Object.keys(respond).length > 0 ? { respond } : {}),
|
|
111
|
+
// #5399: the refused-wave summary's settings; the jobs carry them only with wave-refused=summary.
|
|
112
|
+
...(args.waveSummary ? (() => { const s = waveSummaryFromFlags(args.waveSummary); return "spec" in s ? { waveSummary: s.spec } : {}; })() : {}),
|
|
113
|
+
// #5399: the facts a failed apply records for an agent, with the relay key.
|
|
114
|
+
...(() => { const f = agentFactsFromFlags(args); return "facts" in f && f.facts ? { agentFacts: f.facts } : {}; })(),
|
|
109
115
|
...(args.decideBackend && args.decideModel ? { decide: { backend: args.decideBackend, model: args.decideModel } } : {}),
|
|
110
116
|
// #4935: the runner identity the note job signs with, the check job and the ref gate's status job.
|
|
111
117
|
...(args.evidenceRunnerKeySecret ? { evidence: { runnerKeySecret: args.evidenceRunnerKeySecret } } : {}),
|
|
@@ -135,6 +141,9 @@ export function prLoopFlagsProblem(args) {
|
|
|
135
141
|
...(args.respond !== undefined ? ["--respond"] : []),
|
|
136
142
|
...(args.decideBackend !== undefined ? ["--decide-backend"] : []),
|
|
137
143
|
...(args.decideModel !== undefined ? ["--decide-model"] : []),
|
|
144
|
+
...(args.waveSummary !== undefined ? ["--wave-summary"] : []),
|
|
145
|
+
...(args.agentFactsTriggers !== undefined ? ["--agent-facts"] : []),
|
|
146
|
+
...(args.agentFactsKeyEnv !== undefined ? ["--agent-facts-key-env"] : []),
|
|
138
147
|
];
|
|
139
148
|
if (!args.prLoop)
|
|
140
149
|
return given.length > 0 ? `${given.join(", ")} set the pull request loop's jobs, so ${given.length === 1 ? "it needs" : "they need"} --pr-loop` : undefined;
|
|
@@ -178,8 +187,46 @@ export function prLoopFlagsProblem(args) {
|
|
|
178
187
|
return "--respond description=check asks a decide service, so it needs --decide-backend <name> and --decide-model <id>";
|
|
179
188
|
if (!check && (args.decideBackend !== undefined || args.decideModel !== undefined))
|
|
180
189
|
return "--decide-backend and --decide-model name the description check's service, so they go with --respond description=check";
|
|
190
|
+
if (args.waveSummary !== undefined) {
|
|
191
|
+
const summary = waveSummaryFromFlags(args.waveSummary);
|
|
192
|
+
if ("error" in summary)
|
|
193
|
+
return summary.error;
|
|
194
|
+
if (respond["wave-refused"] !== "summary")
|
|
195
|
+
return "--wave-summary sets the refused-wave summary's model run, so it goes with --respond wave-refused=summary";
|
|
196
|
+
}
|
|
197
|
+
const facts = agentFactsFromFlags(args);
|
|
198
|
+
if ("error" in facts)
|
|
199
|
+
return facts.error;
|
|
181
200
|
return undefined;
|
|
182
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* The refused-wave summary's settings of `--wave-summary <field>=<value>`
|
|
204
|
+
* (#5399), with the numeric fields as numbers, or the reason they are not
|
|
205
|
+
* settings. The fields are those of {@link WaveSummarySpec}.
|
|
206
|
+
*/
|
|
207
|
+
export function waveSummaryFromFlags(flags) {
|
|
208
|
+
const spec = {};
|
|
209
|
+
for (const [field, value] of Object.entries(flags)) {
|
|
210
|
+
spec[field] = field === "timeout" || field === "maxRuns" || field === "maxCostUsd" ? (value.trim() === "" ? Number.NaN : Number(value)) : value;
|
|
211
|
+
}
|
|
212
|
+
const problem = waveSummarySpecProblem(spec);
|
|
213
|
+
return problem ? { error: `--wave-summary: ${problem}` } : { spec: spec };
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The agent facts of `--agent-facts` and `--agent-facts-key-env` (#5399), or
|
|
217
|
+
* the reason they are not settings.
|
|
218
|
+
*/
|
|
219
|
+
export function agentFactsFromFlags(args) {
|
|
220
|
+
if (args.agentFactsTriggers === undefined) {
|
|
221
|
+
return args.agentFactsKeyEnv === undefined ? {} : { error: "--agent-facts-key-env names the relay key of the recorded facts, so it goes with --agent-facts" };
|
|
222
|
+
}
|
|
223
|
+
const unknown = args.agentFactsTriggers.filter((t) => !AGENT_FACTS_TRIGGERS.includes(t));
|
|
224
|
+
if (args.agentFactsTriggers.length === 0 || unknown.length > 0)
|
|
225
|
+
return { error: `--agent-facts takes ${AGENT_FACTS_TRIGGERS.join(" or ")}${unknown.length ? `, not ${unknown.join(", ")}` : ""}` };
|
|
226
|
+
if (args.agentFactsKeyEnv !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(args.agentFactsKeyEnv))
|
|
227
|
+
return { error: `--agent-facts-key-env takes a variable name, not ${args.agentFactsKeyEnv}` };
|
|
228
|
+
return { facts: { triggers: args.agentFactsTriggers, ...(args.agentFactsKeyEnv ? { relayKeyEnv: args.agentFactsKeyEnv } : {}) } };
|
|
229
|
+
}
|
|
183
230
|
/**
|
|
184
231
|
* `--own-jobs <file>` and `--keep-own-jobs` (#4769): `yaml` with the jobs of
|
|
185
232
|
* `file` after chant's, then the jobs of the file at `target` that the new
|
|
@@ -384,6 +431,17 @@ async function runGenerateComponents(ctx) {
|
|
|
384
431
|
return 1;
|
|
385
432
|
}
|
|
386
433
|
}
|
|
434
|
+
// #5348: the declaration's config and secret sets; the loop hands the pipeline's environment its own.
|
|
435
|
+
let environmentSets;
|
|
436
|
+
if (found && args.prLoop) {
|
|
437
|
+
try {
|
|
438
|
+
environmentSets = await (await import("../../workspace/ci-cloud-identity.js")).declaredEnvironmentSets(resolve(args.path));
|
|
439
|
+
}
|
|
440
|
+
catch (err) {
|
|
441
|
+
console.error(formatError({ message: err instanceof Error ? err.message : String(err) }));
|
|
442
|
+
return 1;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
387
445
|
// #4330: the identity a pull request environment's jobs trade for, from a rule that names those environments.
|
|
388
446
|
let prEnvIdentity;
|
|
389
447
|
if (found && args.prLoop && args.prEnv) {
|
|
@@ -445,7 +503,7 @@ async function runGenerateComponents(ctx) {
|
|
|
445
503
|
: {}),
|
|
446
504
|
// #3183: a plan job per pull request and an apply job per merge.
|
|
447
505
|
// #4292: on the branch ci.branches routes the member to, when it routes it.
|
|
448
|
-
...(args.prLoop ? { prLoop: { ...prLoopOption(args, reportUrl, reviewRules, isolatedRunners), ...(plan?.branch ? { branch: plan.branch } : {}), ...(identity ? { identity } : {}), ...(prEnvIdentity ? { prEnvIdentity } : {}), ...(locks ? { locks } : {}), ...(engineSetup.length > 0 ? { engineSetup } : {}), ...(lockGrain ? { lockGrain } : {}), ...(control ? { control } : {}) } } : {}),
|
|
506
|
+
...(args.prLoop ? { prLoop: { ...prLoopOption(args, reportUrl, reviewRules, isolatedRunners), ...(plan?.branch ? { branch: plan.branch } : {}), ...(identity ? { identity } : {}), ...(environmentSets ? { environmentSets } : {}), ...(prEnvIdentity ? { prEnvIdentity } : {}), ...(locks ? { locks } : {}), ...(engineSetup.length > 0 ? { engineSetup } : {}), ...(lockGrain ? { lockGrain } : {}), ...(control ? { control } : {}) } } : {}),
|
|
449
507
|
// #4002: the job image and the lines that install what it lacks, chant itself included.
|
|
450
508
|
...(args.image ? { image: args.image } : {}),
|
|
451
509
|
...(args.beforeScript?.length ? { beforeScript: args.beforeScript } : {}),
|
|
@@ -515,6 +573,180 @@ export async function buildPathOf(args) {
|
|
|
515
573
|
return args.path;
|
|
516
574
|
return join(args.path, relative(here, resolveSourceDir(here, loaded.config)));
|
|
517
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* The build's refusals of `onVerifyFail: "rollback"` (#5328): each step the
|
|
578
|
+
* member's stages apply (its components' deploy steps, build and publish
|
|
579
|
+
* steps left out, and the pipeline's `defaults.step`) read against its
|
|
580
|
+
* capability by `verifyRollbackProblems`. Empty when no stage sets it, and
|
|
581
|
+
* then nothing is loaded.
|
|
582
|
+
*/
|
|
583
|
+
export async function verifyRollbackBuildProblems(dir, spec) {
|
|
584
|
+
if (!spec.stages.some((s) => s.onVerifyFail === "rollback"))
|
|
585
|
+
return [];
|
|
586
|
+
const { verifyRollbackProblems } = await import("../../pipeline/verify-rollback.js");
|
|
587
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
588
|
+
const { discoverComponents } = await import("../../components/discover.js");
|
|
589
|
+
const { fanOutRegistry } = await import("../../components/fan-out-support.js");
|
|
590
|
+
const { BUILD_STEP_KINDS, PUBLISH_STEP_KINDS } = await import("../../components/promote.js");
|
|
591
|
+
const { config } = await loadChantConfig(dir).catch(() => ({ config: {} }));
|
|
592
|
+
const steps = [];
|
|
593
|
+
if (spec.defaults?.step)
|
|
594
|
+
steps.push({ where: "defaults.step", kind: spec.defaults.step.kind });
|
|
595
|
+
const discovered = await discoverComponents(dir);
|
|
596
|
+
if (discovered.errors.length > 0)
|
|
597
|
+
return discovered.errors.map((e) => `onVerifyFail: "rollback" reads the member's components, and they did not load: ${e.message}`);
|
|
598
|
+
for (const { component } of [...discovered.components.values()].sort((a, b) => a.component.name.localeCompare(b.component.name))) {
|
|
599
|
+
const walk = (phase) => {
|
|
600
|
+
for (const step of (phase.steps ?? [])) {
|
|
601
|
+
if (typeof step.phase === "string" && Array.isArray(step.steps))
|
|
602
|
+
walk(step);
|
|
603
|
+
else if (typeof step.kind === "string" && step.kind !== "gate" && !BUILD_STEP_KINDS.includes(step.kind) && !PUBLISH_STEP_KINDS.includes(step.kind)) {
|
|
604
|
+
steps.push({ where: `component "${component.name}" step ${String(phase.phase)}/${step.kind}`, kind: step.kind });
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
for (const phase of component.deploy)
|
|
609
|
+
walk(phase);
|
|
610
|
+
}
|
|
611
|
+
const registry = await fanOutRegistry(dir, config);
|
|
612
|
+
return verifyRollbackProblems({
|
|
613
|
+
spec,
|
|
614
|
+
steps,
|
|
615
|
+
capability: (kind) => {
|
|
616
|
+
if (!registry.has(kind))
|
|
617
|
+
return undefined;
|
|
618
|
+
const c = registry.resolve(kind);
|
|
619
|
+
return { releaseInputs: typeof c.releaseInputs === "function", rollbackPolicy: c.rollbackPolicy ?? (c.rollback ? "native" : "none-by-design") };
|
|
620
|
+
},
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* The build's refusals of gate steps that name an environment the member
|
|
625
|
+
* does not declare (#5401). The member declares the `environments` of its
|
|
626
|
+
* `chant.config.ts`, its pipeline's stages, and each component's own
|
|
627
|
+
* `environments`. Components are loaded only when a component file mentions
|
|
628
|
+
* `environments`, so a member whose gates name none builds as before; a
|
|
629
|
+
* component that fails to load is left to `chant lint` and the run.
|
|
630
|
+
*/
|
|
631
|
+
export async function gateEnvironmentBuildProblems(path) {
|
|
632
|
+
const loaded = await loadChantConfigUpward(resolve(path)).catch(() => undefined);
|
|
633
|
+
const dir = loaded?.configPath ? dirname(loaded.configPath) : resolve(path);
|
|
634
|
+
const { findComponentFiles, discoverComponents } = await import("../../components/discover.js");
|
|
635
|
+
const { readFileSync } = await import("node:fs");
|
|
636
|
+
const files = await findComponentFiles(dir).catch(() => []);
|
|
637
|
+
const mentions = files.some((file) => {
|
|
638
|
+
try {
|
|
639
|
+
return readFileSync(file, "utf8").includes("environments");
|
|
640
|
+
}
|
|
641
|
+
catch {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
if (!mentions)
|
|
646
|
+
return [];
|
|
647
|
+
const discovered = await discoverComponents(dir).catch(() => undefined);
|
|
648
|
+
if (!discovered)
|
|
649
|
+
return [];
|
|
650
|
+
const components = [...discovered.components.values()].map((d) => d.component);
|
|
651
|
+
const { environmentName, isEnvironmentPattern } = await import("../../config.js");
|
|
652
|
+
const declared = new Set();
|
|
653
|
+
for (const entry of loaded?.config.environments ?? []) {
|
|
654
|
+
const name = environmentName(entry);
|
|
655
|
+
if (!isEnvironmentPattern(name))
|
|
656
|
+
declared.add(name);
|
|
657
|
+
}
|
|
658
|
+
const { readMemberPipeline } = await import("../../pipeline/read.js");
|
|
659
|
+
const pipeline = readMemberPipeline(dir);
|
|
660
|
+
if (pipeline.status === "folded")
|
|
661
|
+
for (const stage of pipeline.spec.stages)
|
|
662
|
+
declared.add(stage.name);
|
|
663
|
+
for (const c of components)
|
|
664
|
+
for (const e of c.environments ?? [])
|
|
665
|
+
declared.add(e.name);
|
|
666
|
+
const { unknownGateEnvironments } = await import("../../components/step-environments.js");
|
|
667
|
+
return unknownGateEnvironments(components, declared).map((p) => p.message);
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* The build's findings for `identity.gates.<gate>.agentPassesAlone` (#5388),
|
|
671
|
+
* from the declaration of the workspace holding `path`. `stages` refuses the
|
|
672
|
+
* key on an entry naming one of those stages' gates; with `opsDir`, the Ops
|
|
673
|
+
* built there are read for the warnings. Undefined outside a workspace, or
|
|
674
|
+
* when the declaration does not read: the build reports that elsewhere.
|
|
675
|
+
*/
|
|
676
|
+
export async function agentPermitBuildCheck(path, options) {
|
|
677
|
+
const found = findWorkspaceRoot(resolve(path));
|
|
678
|
+
if (!found)
|
|
679
|
+
return undefined;
|
|
680
|
+
const { readDeclaration } = await import("../../workspace/declaration.js");
|
|
681
|
+
const { workingTree } = await import("../../workspace/tree.js");
|
|
682
|
+
let gates;
|
|
683
|
+
try {
|
|
684
|
+
gates = readDeclaration(workingTree(found.dir)).identity?.gates ?? {};
|
|
685
|
+
}
|
|
686
|
+
catch {
|
|
687
|
+
return undefined;
|
|
688
|
+
}
|
|
689
|
+
if (!Object.values(gates).some((g) => g.agentPassesAlone === true) && !options.opsDir)
|
|
690
|
+
return { warnings: [], refusals: [] };
|
|
691
|
+
const { agentPermitBuildFindings, opGatesWithApproval } = await import("../../op/agent-permit.js");
|
|
692
|
+
let ops;
|
|
693
|
+
if (options.opsDir) {
|
|
694
|
+
const { existsSync, readdirSync, readFileSync } = await import("node:fs");
|
|
695
|
+
ops = [];
|
|
696
|
+
for (const name of existsSync(options.opsDir) ? readdirSync(options.opsDir).sort() : []) {
|
|
697
|
+
const file = join(options.opsDir, name, "op.json");
|
|
698
|
+
if (!existsSync(file))
|
|
699
|
+
continue;
|
|
700
|
+
try {
|
|
701
|
+
ops.push(...opGatesWithApproval(JSON.parse(readFileSync(file, "utf8")), name));
|
|
702
|
+
}
|
|
703
|
+
catch {
|
|
704
|
+
// An op.json that does not parse is the build's own error to report.
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return agentPermitBuildFindings({ gates, ...(ops ? { ops } : {}), ...(options.stages ? { stages: options.stages } : {}) });
|
|
709
|
+
}
|
|
710
|
+
/** Print the warnings of {@link agentPermitBuildCheck} over the Ops just built under `path`. */
|
|
711
|
+
async function warnAgentPermits(path) {
|
|
712
|
+
const findings = await agentPermitBuildCheck(path, { opsDir: resolve(path, "dist", "ops") }).catch(() => undefined);
|
|
713
|
+
for (const message of findings?.warnings ?? [])
|
|
714
|
+
console.error(formatWarning({ message }));
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Fold the member's `.chant/pipeline.ts` (#5324) and write the spec to
|
|
718
|
+
* `.chant/pipeline.json`. The member is the project the build path belongs
|
|
719
|
+
* to. A file outside the subset fails the build with its finding; it is
|
|
720
|
+
* never run. Returns the exit code of a refusal already printed, or
|
|
721
|
+
* undefined when the build goes on.
|
|
722
|
+
*/
|
|
723
|
+
export async function foldMemberPipeline(path) {
|
|
724
|
+
const loaded = await loadChantConfigUpward(resolve(path)).catch(() => undefined);
|
|
725
|
+
const dir = loaded?.configPath ? dirname(loaded.configPath) : resolve(path);
|
|
726
|
+
const { readMemberPipeline } = await import("../../pipeline/read.js");
|
|
727
|
+
const read = readMemberPipeline(dir);
|
|
728
|
+
if (read.status === "absent")
|
|
729
|
+
return undefined;
|
|
730
|
+
if (read.status === "refused") {
|
|
731
|
+
console.error(formatError({ message: `the pipeline does not fold: ${read.line}`, hint: "A pipeline file stays inside the TypeScript-as-data subset: it is folded, never run." }));
|
|
732
|
+
return 1;
|
|
733
|
+
}
|
|
734
|
+
// #5328: a stage that rolls back on a failed verify or soak applies only steps an earlier release restores.
|
|
735
|
+
const refusals = await verifyRollbackBuildProblems(dir, read.spec);
|
|
736
|
+
// #5388: a stage gate never passes on an agent's permit alone.
|
|
737
|
+
refusals.push(...((await agentPermitBuildCheck(dir, { stages: read.spec.stages }))?.refusals ?? []));
|
|
738
|
+
if (refusals.length > 0) {
|
|
739
|
+
for (const message of refusals)
|
|
740
|
+
console.error(formatError({ message }));
|
|
741
|
+
return 1;
|
|
742
|
+
}
|
|
743
|
+
const { PIPELINE_SPEC_FILE } = await import("../../pipeline/spec.js");
|
|
744
|
+
const out = join(dir, PIPELINE_SPEC_FILE);
|
|
745
|
+
mkdirSync(dirname(out), { recursive: true });
|
|
746
|
+
writeFileSync(out, `${JSON.stringify(read.spec, null, 2)}\n`);
|
|
747
|
+
console.error(formatInfo(`[fold:fold] ${read.file}: pipeline "${read.spec.name}", ${read.spec.stages.length} stage(s), written to ${relative(process.cwd(), out) || PIPELINE_SPEC_FILE}`));
|
|
748
|
+
return undefined;
|
|
749
|
+
}
|
|
518
750
|
export async function runBuild(ctx) {
|
|
519
751
|
const { plugins } = ctx;
|
|
520
752
|
let { serializers } = ctx;
|
|
@@ -526,6 +758,17 @@ export async function runBuild(ctx) {
|
|
|
526
758
|
}
|
|
527
759
|
// #4794: the lexicon build reads the config's sourceDir when no path is given.
|
|
528
760
|
const args = { ...ctx.args, path: await buildPathOf(ctx.args) };
|
|
761
|
+
// #5324: the member's pipeline folds first; one outside the subset stops the build.
|
|
762
|
+
const pipelineRefused = await foldMemberPipeline(args.path);
|
|
763
|
+
if (pipelineRefused !== undefined)
|
|
764
|
+
return pipelineRefused;
|
|
765
|
+
// #5401: a gate that names an environment the member does not declare would be skipped where it was meant to apply.
|
|
766
|
+
const gateProblems = await gateEnvironmentBuildProblems(args.path);
|
|
767
|
+
if (gateProblems.length > 0) {
|
|
768
|
+
for (const message of gateProblems)
|
|
769
|
+
console.error(formatError({ message }));
|
|
770
|
+
return 1;
|
|
771
|
+
}
|
|
529
772
|
// Filter to a single lexicon when --lexicon is specified
|
|
530
773
|
if (args.lexicon) {
|
|
531
774
|
serializers = serializers.filter((s) => s.name === args.lexicon);
|
|
@@ -615,6 +858,8 @@ export async function runBuild(ctx) {
|
|
|
615
858
|
if (!result.success)
|
|
616
859
|
failed = true;
|
|
617
860
|
}
|
|
861
|
+
if (!failed)
|
|
862
|
+
await warnAgentPermits(args.path);
|
|
618
863
|
return failed ? 1 : 0;
|
|
619
864
|
}
|
|
620
865
|
if (args.watch) {
|
|
@@ -658,6 +903,9 @@ export async function runBuild(ctx) {
|
|
|
658
903
|
warnings = warnings.filter((w) => !w.includes('No serializer found for lexicon'));
|
|
659
904
|
}
|
|
660
905
|
printWarnings(warnings);
|
|
906
|
+
// #5388: agent permits on the Ops just built.
|
|
907
|
+
if (result.success)
|
|
908
|
+
await warnAgentPermits(args.path);
|
|
661
909
|
// #4116: errors that are imports of uninstalled packages are led by the dependencies message.
|
|
662
910
|
if (!result.success)
|
|
663
911
|
reportUninstalledDependencies(result.errors, resolve(args.path));
|
|
@@ -77,6 +77,8 @@ import { formatError, formatInfo, formatWarning } from "../format.js";
|
|
|
77
77
|
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
78
78
|
import { FAN_OUT_GATE_OP } from "../../op/gate-name.js";
|
|
79
79
|
import { resolveBuildRoot } from "./lifecycle.js";
|
|
80
|
+
import { fanOutCanarySoak, fanOutCanarySoakOf, fanOutHasCanaryWave } from "../../components/fan-out-canary.js";
|
|
81
|
+
import { promoteBase, readPipelineAt } from "../../pipeline/read.js";
|
|
80
82
|
import { GATED_EXIT_CODE, autoReleaseRun, recordAutoReleasesForRun } from "./run.js";
|
|
81
83
|
import { withComponentEndpoint } from "../component-endpoint.js";
|
|
82
84
|
/**
|
|
@@ -228,6 +230,7 @@ async function fanOut(ctx, projectPath, config) {
|
|
|
228
230
|
buildParams: paramsResolution.provenance,
|
|
229
231
|
config,
|
|
230
232
|
registry,
|
|
233
|
+
env: args.env ?? "local",
|
|
231
234
|
...(args.canary?.length ? { canary: args.canary } : {}),
|
|
232
235
|
});
|
|
233
236
|
}
|
|
@@ -432,6 +435,34 @@ async function fanOut(ctx, projectPath, config) {
|
|
|
432
435
|
// #4594: ci.lockGrain, and on the resource grain the row lease each step, group or gated wave takes in the pull-request loop's rows file.
|
|
433
436
|
const { applyLeaseOptions } = await import("../../components/apply-lease.js");
|
|
434
437
|
const leasing = await applyLeaseOptions(process.cwd());
|
|
438
|
+
// #5327: the canary wave's soak, the soak of the pipeline stage this fan-out runs in, holds every wave after it.
|
|
439
|
+
if (args.canary?.length && fanOutHasCanaryWave(derived.plan.waves, args.canary)) {
|
|
440
|
+
const soak = canaryStageSoak(projectPath, env);
|
|
441
|
+
if (typeof soak === "number")
|
|
442
|
+
return soak;
|
|
443
|
+
if (soak && !waveGate) {
|
|
444
|
+
console.error(formatError({
|
|
445
|
+
message: `stage "${env}" of the member's pipeline has a soak, which holds the waves after the canary, and this fan-out runs every wave at once`,
|
|
446
|
+
hint: "Pass --wave-gate <name> so each wave after the canary waits for its soak.",
|
|
447
|
+
}));
|
|
448
|
+
return 1;
|
|
449
|
+
}
|
|
450
|
+
if (soak && waveGate) {
|
|
451
|
+
const { gitGateLedgerPort } = await import("../../op/gate.js");
|
|
452
|
+
const { soakCheckReader } = await import("../../pipeline/soak-checks.js");
|
|
453
|
+
const { jobSoakSources } = await import("../../pipeline/soak-sources.js");
|
|
454
|
+
waveGate.soak = fanOutCanarySoak({
|
|
455
|
+
op: FAN_OUT_GATE_OP,
|
|
456
|
+
gate: waveGate.gate,
|
|
457
|
+
soak,
|
|
458
|
+
env,
|
|
459
|
+
canaryWave: () => wavesSoFar.find((w) => w.wave === 1),
|
|
460
|
+
port: gitGateLedgerPort(),
|
|
461
|
+
read: soakCheckReader(jobSoakSources({ op: FAN_OUT_GATE_OP, cwd: projectPath })),
|
|
462
|
+
log: (line) => console.error(formatInfo(line)),
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
435
466
|
let result;
|
|
436
467
|
try {
|
|
437
468
|
result = await runFanOut(runPlan, derived.components, registry, {
|
|
@@ -536,6 +567,13 @@ async function fanOut(ctx, projectPath, config) {
|
|
|
536
567
|
// #4274: a component that publishes nothing is recorded by its deploy-input digest.
|
|
537
568
|
appliedDigestOf({ components: derived.components, env: args.env ?? "local", projectRoot: projectPath }));
|
|
538
569
|
}
|
|
570
|
+
// #5327: the canary's soak stopped the run before a later wave planned.
|
|
571
|
+
if (result.soak) {
|
|
572
|
+
console.error(formatInfo(result.soak.message));
|
|
573
|
+
console.error(formatInfo(result.soak.hint));
|
|
574
|
+
if (!result.gate)
|
|
575
|
+
return result.status === "gated" ? GATED_EXIT_CODE : failedRunExitCode(result.results);
|
|
576
|
+
}
|
|
539
577
|
// A failed root outranks a gate in the status, but a gated-wave run that
|
|
540
578
|
// stopped at a wave's gate still prints how to approve it.
|
|
541
579
|
if (result.gate && (result.status === "gated" || waveGate)) {
|
|
@@ -561,3 +599,20 @@ async function fanOut(ctx, projectPath, config) {
|
|
|
561
599
|
// approval exits 3, the code of a wave whose plan changed (#3997).
|
|
562
600
|
return result.status === "ok" ? 0 : failedRunExitCode(result.results);
|
|
563
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* The soak a fan-out's canary takes (#5327): stage `env`'s soak in the
|
|
604
|
+
* member's pipeline at the default branch's tip, as a promote reads it.
|
|
605
|
+
* Undefined with no pipeline, no such stage, or no soak; exit 1 when the
|
|
606
|
+
* pipeline there does not fold, since its soak cannot be read.
|
|
607
|
+
*/
|
|
608
|
+
function canaryStageSoak(projectPath, env) {
|
|
609
|
+
const base = promoteBase(projectPath);
|
|
610
|
+
if (!base)
|
|
611
|
+
return undefined;
|
|
612
|
+
const read = readPipelineAt(base, projectPath);
|
|
613
|
+
if (read.status === "refused") {
|
|
614
|
+
console.error(formatError({ message: `the pipeline at ${base.slice(0, 12)} does not fold, so the canary's soak cannot be read and nothing ran: ${read.line}` }));
|
|
615
|
+
return 1;
|
|
616
|
+
}
|
|
617
|
+
return read.status === "folded" ? fanOutCanarySoakOf(read.spec, env) : undefined;
|
|
618
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type GraphIR } from "../../graph-ir.js";
|
|
1
2
|
import { type LintResult } from "../commands/lint.js";
|
|
2
3
|
import type { CommandContext } from "../registry.js";
|
|
4
|
+
import type { PlacedGraphRead } from "../../components/declared-reads.js";
|
|
3
5
|
/**
|
|
4
6
|
* `chant graph` — the Op dependency graph by default; `--stacks` renders the
|
|
5
7
|
* cross-stack apply-ordering graph (edges, order, waves) chant computes from
|
|
@@ -41,3 +43,15 @@ export interface GraphLintReport {
|
|
|
41
43
|
findings: GraphLintFinding[];
|
|
42
44
|
}
|
|
43
45
|
export declare function graphLintReport(lint: LintResult, projectPath: string): GraphLintReport;
|
|
46
|
+
/** The id of the node a stack outside the project is drawn as (#5331). */
|
|
47
|
+
export declare function externalStackNodeId(name: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* The reads a capability finds in its steps' files (#5331, a Pulumi
|
|
50
|
+
* program's `StackReference`s) as edges of the component graph: from the
|
|
51
|
+
* reader to the component that deploys the stack it reads, `viaAttr` naming
|
|
52
|
+
* the output where the program shows it. A stack no component deploys is a
|
|
53
|
+
* node of kind `ExternalStack` with `attrs.external: true`, and the edge goes
|
|
54
|
+
* to it. The edges carry `origin: "declared"` beside the `dependsOn` edges
|
|
55
|
+
* they may repeat, since they differ in `viaAttr`. Pure.
|
|
56
|
+
*/
|
|
57
|
+
export declare function withStackReads(ir: GraphIR, reads: readonly PlacedGraphRead[]): GraphIR;
|