chant components
Synopsis
Section titled “Synopsis”chant components release <env> --component <name> --digest <sha256:...> [--git-sha <sha>] [--run-id <id>] [--actor <name>] [--json]chant components status [env] [--live] [--json] [--compare-to <env>]chant components export <env> --component <name> [--digest <manifestDigest>] -o <dir> [--json]chant components fan-out (--base <ref> [--head <ref>] [--include-dependents] | --from-affected <file>) [--env <env>] [--gate <name> | --wave-gate <name> [--canary <name>] [--wave <n>]] [--dry-run] [--json] [--target <component>:<address>] [--resume <file>] [--seed-outputs <file>] [--dump-outputs <file>] [--progress-json | --events-json]chant components pr-plan --base <ref> --pr <n> [--env <env>] [--gate <name>] [--forge github|gitlab|forgejo] [--member <name>] [--target <address> | --target <component>:<address>] [--target-dependents] [--refresh] [--output <dir>] [--json] [--events-json] [--report-url <url>]chant components pr-post --pr <n> --head <sha> --env <env> --forge github|gitlab|forgejo [--member <name>] [--output <dir>] [--result <result>] [--context <context>]chant components pr-post --open --env <env> --forge gitlab [--branch <branch>] [--member <name>] [--output <dir>] [--context <context>] [--plan-job <name>]chant components pr-apply (--base <ref> [--pr <n>] | --green [--base <ref>] | --before-merge --base <ref> --pr <n>) [--env <env>] [--gate <name>] [--forge github|gitlab|forgejo] [--require-review] [--member <name>] [--resume <file>] [--output <dir>] [--json] [--events-json] [--report-url <url>] [--wave-gate <name> [--wave <k>]]chant components plan-wave|apply-wave --runs <file> --plans <file> --base <ref> --env <env> [--head <ref>] [--member <name>] [--gate <name>] [--wave-outputs <file>]chant components pr-env up --base <ref> --pr <n> [--forge github|gitlab|forgejo] [--member <name>] [--output <dir>] [--no-push] [--json]chant components pr-env post --pr <n> --head <sha> [--result <result>] [--forge <kind>] [--member <name>] [--output <dir>]chant components pr-env down --pr <n> [--reason closed|expired] [--forge <kind>] [--member <name>] [--output <dir>] [--no-push] [--json]chant components pr-env sweep [--forge <kind>] [--member <name>] [--output <dir>] [--no-push]chant components promote --to <env> [--from <env>] [--allow-skip] [--release <label|digest> [--plan-only]] [--component <name> [--digest <sha256:...>] | --digest <component>=<sha256:...> ...] [--dry-run] [--json] [--seed-outputs <file>] [--run-id <id>] [--actor <name>] [--events-json]chant components rollback <env> (--component <name> [--digest <sha256:...>] | --release <label|digest> | --requested) [--dry-run] [--json] [--seed-outputs <file>] [--run-id <id>] [--actor <name>] [--events-json]chant components redeploy <env> --component <name> [--digest <sha256:...>] [--dry-run] [--json] [--seed-outputs <file>] [--run-id <id>] [--actor <name>] [--events-json]Description
Section titled “Description”chant components holds the release ledger, status surface, and build-archive export for component deploys: the recorded half of build & deploy observability. See Observability for the conceptual model. The release ledger lives on the same chant/lifecycle orphan branch chant lifecycle snapshots already use, at <env>/releases.jsonl, with one immutable JSON line per recorded deploy.
components fan-out is the odd one out on this page. It runs rather than records, taking a change signal and applying the components downstream of it in a derived order. It sits here because it is the component subsystem’s own dispatch path, next to the ledger those deploys write to.
components release below is the standalone, explicit way to append a record. chant run --components auto-emits one on every successful deploy, so most projects never call components release directly. Use it for CI compositions and Verify phases outside chant run’s own execution.
Subcommands
Section titled “Subcommands”components release <env>
Section titled “components release <env>”Append one immutable release record: (component, env, artifact digest, git sha, run id, timestamp, actor).
chant components release prod \ --component search-service \ --digest sha256:9fae3d7c... \ --git-sha "$(git rev-parse HEAD)" \ --run-id "$GITHUB_RUN_ID" \ --actor "$GITHUB_ACTOR"| Flag | Meaning |
|---|---|
--component <name> | Required. The component this deploy released. |
--digest <sha256:...> | Required. The promoted artifact’s content digest — the join key with the build archive/ledger. |
--git-sha <sha> | Git commit the deploy was built from. Defaults to the current HEAD. |
--run-id <id> | Orchestrator/CI run identifier. Defaults to $GITHUB_RUN_ID or $CI_PIPELINE_ID, else a locally generated id. |
--actor <name> | Who/what triggered the deploy. Defaults to $GITHUB_ACTOR, $GITLAB_USER_LOGIN, or $USER — but must resolve to something; an unattributed record fails rather than falls back to a placeholder. |
--json | Print the recorded record as JSON instead of a human summary. |
The timestamp is always a real new Date() taken by the CLI at record time, never threaded in from elsewhere or re-derived later. A record is never edited or replaced: recording again appends a new line.
Pushes to the remote afterward using the same --force-with-lease protocol snapshots use; a concurrent write from another operator is rejected with a recovery hint rather than silently overwritten.
components status [env]
Section titled “components status [env]”Reconcile the release ledger against live truth (when --live is passed) or report the ledger alone.
chant components status prod # ledger only — no live querychant components status prod --live # reconcile against live + ownershipchant components status prod --live --json # stable JSON contractchant components status prod --compare-to staging # cross-env digest comparisonchant components status # every environment with release recordsWithout --live, every recorded component reports unknown reconciliation, since the ledger alone can’t confirm live state. With --live, chant components status reuses the same ownership-aware classification lifecycle plan already computes (buildChangeSet) to produce one of:
| Reconciliation | Meaning |
|---|---|
reconciled | Recorded, and live evidence confirms the component is present and chant-owned. |
unrecorded | Live and owned, but no release record exists — deployed outside the recorded path. |
stale | Recorded, but nothing observed live now. |
drifted | Recorded and live, but what was observed contradicts the release (see below). |
unknown | No live evidence requested, or live state could not be read. |
A component is drifted when a resource it owns was read live and any of these hold:
- the resource reports
attributes.digestand it matches neither the recordeddigestnor itsinputDigest, or it reportsattributes.gitShaand it differs from the recordedgitSha(an abbreviated sha of 7+ characters matches by prefix); - its configuration changed against the last lifecycle snapshot, the same
updateverdictlifecycle plangives, and that snapshot was taken at or after the release (a snapshot older than the release would count the release’s own changes); - since that snapshot, chant’s ownership marker disappeared (
ownedtoforeign) or now names a different stack or environment.
A resource that could not be read reports unknown, never drifted. A resource that reports no identity attribute, or unknown ownership, is no evidence either way. Lexicons opt in to the identity check by setting those two attributes.
--compare-to <env> answers “which build is in <env>, and is it the one tested in <compare-to>” as a single query, per component:
chant components status prod --compare-to staging --json{ "rows": [ /* ... */ ], "comparisons": [ { "component": "search-service", "envA": "prod", "envB": "staging", "digestA": "sha256:9fae3d...", "digestB": "sha256:9fae3d...", "same": true } ]}| Flag | Meaning |
|---|---|
--live | Query lexicon plugins’ describeResources() now and reconcile against ownership + drift, instead of reporting the ledger alone. |
--json | Emit a stable array of rows (or { rows, comparisons } with --compare-to). |
--compare-to <env> | Cross-check the requested env’s recorded digest against another environment’s, per component. |
components export <env>
Section titled “components export <env>”Materialize a persisted build archive manifest to a portable, downloadable directory: every image/template/asset/sbom entry copied byte-for-byte from where the build that produced it left it on disk (its archive-relative path, resolved against the current working directory) into -o <dir>, with a self-describing manifest.json beside them. It copies what a prior chant build/run --components produced and regenerates nothing, so the export is byte-identical to what was built (promote-by-digest holds).
chant components export prod --component search-service -o ./dist/search-servicechant components export --digest sha256:9fae3d7c... -o ./dist/search-service --jsonManifest resolution:
--digest <manifestDigest>reads the manifest directly, independent of any environment or release record.- Without
--digest, resolves “the manifest behind this component’s most recent successful run” in<env>: the latest release record’s ownmanifestDigestwhen one was recorded, else a reverse lookup by its promoted artifact digest, the same joinchant components statusperforms.
| Flag | Meaning |
|---|---|
--component <name> | Required unless --digest is given. Which component’s most recent recorded build to export. |
--digest <manifestDigest> | Export this build archive manifest directly, bypassing environment/component resolution. |
-o, --output <dir> | Required. Directory the archive is materialized into. |
--json | Emit a structured per-entry summary instead of a human-readable list. |
A source file missing on disk (the build ran somewhere else, or its output was since cleaned) is reported per entry, and the command exits non-zero, so an incomplete export is never mistaken for a complete one. Run it from the same checkout the build that produced the manifest ran in.
{ "component": "search-service", "manifestDigest": "sha256:9fae3d...", "outDir": "/abs/path/dist/search-service", "entries": [ { "kind": "template", "path": "search.template.json", "digest": "sha256:...", "status": "materialized" }, { "kind": "image", "path": "dist/app.tar", "digest": "sha256:...", "status": "materialized" } ]}components fan-out
Section titled “components fan-out”Run a change out across the components downstream of it, in an order chant derives from the source. See Orchestration for the model behind it.
chant components fan-out --base origin/main --env prod --dry-runchant components fan-out --base origin/main --env prod --gate release --resume .chant/fan-out.jsonchant approve fan-out release --plan jcs1-sha256:9fae3d7c...chant components fan-out --base origin/main --env prod --gate release --resume .chant/fan-out.jsonWhere the change signal comes from
Section titled “Where the change signal comes from”Exactly one of --base and --from-affected is required. Both at once is refused, and so is neither, because defaulting one way or the other would let a stale file silently beat a fresh diff, or a fresh diff silently beat a file somebody meant to use.
--base <ref> derives the signal in place, running the same artifact diff chant lifecycle affected runs. That is the one-command shape for a developer working in a checkout. --from-affected <file> reads the JSON that chant lifecycle affected --base <ref> --json already wrote, which is what a CI job wants when an earlier step ran the diff and there is no reason to build twice. Reading a file builds nothing, so this form works in a project whose lexicon plugins are not installed.
Either way the signal names stacks. A component claims a stack through its own deploy steps, so the join to components needs no fan-out config restating a relationship the composition already makes. A changed stack that no component deploys is reported as a warning naming that stack, because it is a hole in the fan-out’s coverage.
--include-dependents is handed to the diff and folded into the changed set before the join.
A unit that is not chant source never shows in the artifact diff. The terraform lexicon answers for its roots from the changed paths instead. A root in terraform.roots is changed when a changed file sits in its directory, in a local module it calls, or is one of its var files. --base adds those roots to the signal.
The printed derivation
Section titled “The printed derivation”--dry-run prints the derivation and dispatches nothing. A dispatching run prints the same block first, so what ran always follows why it was picked.
fan-out: 3 selected, 4 unaffected, 0 indeterminate wave 1: cluster-a wave 2: app-one, app-two seeded from an earlier run: net not running (4): app-three unaffected billing unaffected cluster-b unaffected net unaffected plan: jcs1-sha256:9fae3d7c... approve: chant approve fan-out release --plan jcs1-sha256:9fae3d7c...Each line answers a question an operator would otherwise have to ask.
- The waves are the derived order shown as a graph. A flat list could not show that the order came out of each component’s
dependsOnrather than out of somebody’s hand. - Every component that is not running is named with its reason, one of
unaffected,indeterminate,already-appliedorblocked. Ablockedrow also names the failure it was reached from, asblocked by "cluster-a". Absent from a list and deliberately held back would read identically without this. indeterminatehas a count on the first line, and components a source diff could not judge that the walk never reached get a line of their own (a source diff cannot judge these, and the walk did not reach them: ...). It is the third outcome, and a two-state render would silently fold it into one of the other two.seeded from an earlier runlists dependencies of selected components that are not themselves running. Their outputs are taken on trust from a run that happened earlier and somewhere else, which is the price of running a subset instead of the whole graph. Before the run starts, each seed that--seed-outputsand the--resumerecord leave out is read from the deployed estate through its step’soutputs, ascfn-deployandterraform-applyprovide, and a line on stderr names the outputs read (#4104). A seed whose steps can’t report outputs leaves its dependents’ references unresolved. A read that fails stops the fan-out before anything runs.plan:carries the digest verbatim and unabbreviated (shortened above to fit this page). It is the exact stringchant approve --plantakes, so truncating it for width would make the line useless for the one job it has.approve:appears only when--gate <name>was given, and is the whole command to run.
--json puts JSON on stdout, writes nothing else there, and replaces the human render rather than accompanying it. Under --dry-run the payload is the plan. Without it the payload is the run result, which carries the plan it dispatched under plan. A gated run still prints its approve line on stderr, so a CI job reading stdout as JSON sees the pending gate in its log.
One gate over the whole set
Section titled “One gate over the whole set”--gate <name> puts a single approval over the ordered set, under the op name fan-out. Twenty components behind one fan-out is one approval, not twenty. The gate is evaluated once, before the first wave, bound to the plan’s digest by the same plan-bound gate mechanism a gated Op uses.
Nothing runs while it stands open. The run prints the pending fact and exits 3.
gated: nothing ran. Waiting on "release" on "fan-out".approve : chant approve fan-out release --plan jcs1-sha256:9fae3d7c...The digest identifies the derivation. It covers the ordered selection and the waves, plus the seeds and the edges each component came from. It does not cover what each component would apply, so editing a template without changing the graph leaves the digest, and a standing approval, where they were. planFanOut takes per-component input digests when a caller has them, and this command does not supply any yet. A resolution recorded against a different digest does not let this fan-out through, since a fan-out that derives differently is a different change. Each component’s own authored gates still decide per component. This adds a gate over the set without removing the ones inside it.
One gate per wave
Section titled “One gate per wave”With --wave-gate <name>, each wave gets a gate of its own instead of one gate over the set. For wave n it is <name>-wave-<n> under the op fan-out, bound to that wave’s set digest. Use it when a change is too large or too risky to approve in one read. A module bump across many Terraform roots is the usual case. A canary goes first, and the rest wait until it applies.
chant components fan-out --base origin/main --env prod --wave-gate release --canary app-dev --resume .chant/fan-out.jsonchant approve fan-out release-wave-1 --plan jcs1-sha256:4c1e...chant components fan-out --base origin/main --env prod --wave-gate release --canary app-dev --resume .chant/fan-out.jsonchant approve fan-out release-wave-2 --plan jcs1-sha256:b07a...A wave is planned only when it is reached, after the wave before it applied. Each component in the wave is asked what it would change: every step whose capability can plan (cfn-deploy, kubectl-apply and terraform-apply, see plan previews) is planned with its wiring resolved against the outputs the earlier waves wrote. A later wave planned up front would read outputs that do not exist yet, and its digest would describe values nobody will deploy. The member for a planned step is what it planned, the root for terraform-apply, and its digest is the one a gate on that root alone binds. A component with no step that can plan is a member under its own name, with the composition digest its own gates bind. The wave’s digest is the change-set digest of its members. The apply then uses the plan that was approved.
The run stops at the first wave nobody approved, exits 3 and prints the approve line. Earlier waves in the same run have applied by then. An approval names a digest. One recorded with no digest, or with another wave’s digest, does not let a wave through. If the set changed after someone approved it, the run stops at that wave and applies nothing in it. The message names both digests.
wave 1 changed after it was approved, so nothing in it was applied. approved: jcs1-sha256:4c1e...; planned now: jcs1-sha256:e93d.... Read the new plan, then approve it: chant approve fan-out release-wave-1 --plan jcs1-sha256:e93d...--canary <name> (repeatable, or comma-separated) puts components in wave 1 whatever the graph order. The remaining waves follow the graph. A canary the change does not select has nothing to apply and is left out. When the member’s pipeline gives the --env stage a soak, that soak holds every wave after the canary: before each later wave plans, the fan-out reads it through gate <name>-wave-1-soak, from the time the canary wave’s applies ended, and exits 3 while it holds. Approving that gate ends it early. A fan-out without --wave-gate runs every wave at once, so it refuses --canary when the stage has a soak. See The canary.
Wave numbers come from the derivation, so on a resumed attempt wave 3 is still wave 3 and its approval still applies. With --resume, the record keeps one entry per wave it reached. An entry names the wave’s gate and its set digest. It lists each member’s plan digest and says whether the wave applied, failed or is waiting. The re-run plans each remaining wave afresh, since the gate is about the plan now, and never applies a component the record says applied. A failed component blocks its dependents, as in the whole-set mode. Its retry is planned again and needs a fresh approval, because what is left is a different set from the one approved.
--wave <n> runs wave n and no other, which is the shape for CI with one job per wave. It refuses while an earlier wave has work left, and a wave past the last one the change has exits 0. When the record says an earlier component failed, wave n blocks that component’s dependents and runs the rest. A blocked member of wave n makes the job exit 1 (#4291). When an earlier wave waits at its gate, wave n exits 3 with nothing run. chant build --components --generate gitlab|github|forgejo --wave-gate <name> writes that pipeline. Job wave-k runs --wave k and needs wave-(k-1). It hands the --resume record on as an artifact, even when it stops at a gate. Approve, then re-run the job that stopped. The pipeline measures the change from HEAD~1. Pass --base <ref> to the build command to measure it from somewhere else; every job must use the same ref, so it is a fixed one.
A gated-wave fan-out has no plan on a pull request. To review the whole plan on the pull request and still gate each wave on merge, use pr-apply --wave-gate, which --pr-loop --wave-gate <name> generates. There a wave whose plan the pull request’s approval covers needs no approval of its own.
--gate and --wave-gate are refused together. Use --gate when one person reads the whole change once, the fan-out is small, and its components do not read each other’s fresh outputs at plan time. Use --wave-gate when the change should apply in stages, when a later root’s plan depends on what an earlier one writes, or when the set is too large to review as one.
Failure semantics
Section titled “Failure semantics”A failed component stops its own subtree and nothing else. Components beneath it record as blocked naming the failure rather than as failed, because they did not fail, which keeps the next attempt readable. Branches sharing no edge with the failure run to completion.
applied: app-three, cluster-b, netfailed: cluster-a app-one: blocked by "cluster-a", so it never ran app-two: blocked by "cluster-a", so it never ranfan-out failed: 3 applied, 1 failed, 2 blockedWith --events-json, each blocked component settles in the stream as blocked with blockedBy naming the failure, right after the failing wave settles. On a resumed run each component the earlier attempt applied settles as already-applied before the first wave. See run events.
This is where a fan-out departs from chant run --components all, which stops the whole run at the first failed component and goes on doing so. There the user asked for everything, so a failure means the estate is in a state nobody described. Here the order was derived from the source, so a branch independent of the failure is known to be independent rather than assumed to be, and stopping it buys nothing while costing a second approval to finish.
Finishing an attempt that stopped
Section titled “Finishing an attempt that stopped”--resume <file> names an attempt record. The run reads it before it starts. It rewrites the record as each component settles and once more when it finishes, including after a failure and after a gate, because the next attempt needs to know what this one got through. A fan-out killed partway through, by a cancelled CI job or ctrl-c, leaves a record naming every component that had applied by then. The record is replaced through a rename, so a kill during the write leaves the previous record intact.
Each completed component’s outputs are saved alongside its name. A component still to run that reads one of them through stackOutput() gets the saved value, so the re-run needs no --seed-outputs for work this fan-out already did. A saved output wins over a --seed-outputs entry for the same component. Stack outputs end up in this file, so keep it wherever --dump-outputs files are kept.
Repeating the identical command finishes the work. The record narrows the plan before the gate is decided, and the digest is carried rather than recomputed, so an approval already given still stands. The re-run prints what it is skipping as already-applied and dispatches only the rest.
Only the earlier attempt’s completions are carried forward. Its failures are recorded in the file for whoever has to read it, but feeding them back as progress would block their subtrees again on the run meant to retry them.
--dry-run reads the record too, so a plan-only invocation alongside --resume shows what is left and prints the digest the earlier approval was given for.
A record whose digest does not match the fan-out derived now is refused with a warning, and its progress is not applied. The derivation changed, which makes this a different change, and carrying cluster-a already applied into it would be a claim about work nobody did.
A matching digest is not enough on its own. A later change that touches the same components in the same shape derives the same digest as the attempt before it. For that reason the record also keeps the input digest of each component it applied, and a component carries as already-applied only when its input digest is the same now. The input digest is taken over the environment and the component’s steps as written. It also takes in the bytes of every file or directory a step input names inside the project, such as a cfn-deploy step’s built template, and the input digests of the components it depends on. A parameter read from an upstream output therefore counts as changed when that upstream changed. A component whose input moved runs again, and the run prints a line for it on stderr:
cluster-a: changed since the earlier attempt, so it runs againA record written by a chant release older than this one keeps no input digests. None of its progress carries, the run says so in a warning, and everything selected runs.
Progress and approval are bound to different things. The gate’s approval is bound to the plan digest, so the fix after a failure keeps the approval it already has. Progress is bound to each component’s input digest, so a different change with the same shape gets none of it. A standing approval does cover a later change of the same shape until it expires. When each change’s content needs its own approval, use pr-apply, which binds its approval to the planned change set.
Seeding and progress
Section titled “Seeding and progress”--seed-outputs <file> (repeatable) loads component outputs before the run, so a stackOutput() or @<dep>.publish.* reference into a component the plan lists under seeds resolves without reading that component’s deployed outputs. --dump-outputs <file> writes what the run holds afterwards. --progress-json streams one NDJSON progress record per line to stdout as the waves execute, and --events-json streams the run-event stream instead. These behave as they do on chant run --components.
| Flag | Meaning |
|---|---|
--base <ref> | Derive the change signal here, by diffing built artifacts against this git ref. Required unless --from-affected is given. |
--head <ref> | Head ref for that diff. Defaults to the working tree. |
--include-dependents | Add downstream consumers of changed stacks to the signal before the join to components. |
--from-affected <file> | Read the change signal from JSON chant lifecycle affected --json already wrote. Required unless --base is given. |
--env <env> | Environment each selected component deploys into. Defaults to local. |
--gate <name> | One approval over the whole derived set, answered by chant approve fan-out <name> --plan <digest>. |
--wave-gate <name> | One approval per wave, each bound to its wave’s set digest and answered by chant approve fan-out <name>-wave-<n> --plan <digest>. Not with --gate. |
--canary <name> | With --wave-gate, components that form wave 1. Repeatable, or comma-separated. |
--wave <n> | With --wave-gate, run wave n and no other: one CI job per wave. |
--target <component>:<address> | Plan and apply only this address of the component. Repeatable. The targets join the digest the gate binds. See Plan and Apply a Few Resources. |
--dry-run | Print the derivation and dispatch nothing. |
--json | Emit the plan (with --dry-run) or the run result on stdout, and nothing else on stdout. |
--resume <file> | Attempt record read before the run and written after it, so repeating the command finishes what stopped. |
--seed-outputs <file> | Load component outputs before the run. Repeatable; a later file wins on a key two files share. |
--dump-outputs <file> | Write the outputs the run holds to this file afterwards. |
--progress-json | Stream one NDJSON progress record per line to stdout while the waves execute. |
--events-json | Stream the run’s events to stdout, one run-event.schema.json line each. |
components pr-plan and components pr-apply
Section titled “components pr-plan and components pr-apply”The pull-request loop. pr-plan runs on a pull request, plans the components the change reaches and the ones that depend on them, and shows the plan. After the merge, pr-record plans the same members again and writes the merge record without applying anything (#4168). With apply on merge, pr-apply --green runs once a commit goes green and applies it under the approvals of the merges it carries (#4168 step 9). Generated CI for pull requests writes the pipeline that runs them on GitHub, GitLab and Forgejo.
chant components pr-plan --base origin/main --pr 12 --env prodchant approve pr-12 pr-apply --plan jcs1-sha256:3e43... --approver github:alice --signchant components pr-record --base "$BEFORE_SHA" --pr 12 --env prod# with apply on merge, in place of pr-record:chant components pr-apply --base "$BEFORE_SHA" --pr 12 --env prodcomponents pr-record
Section titled “components pr-record”pr-record takes pr-apply’s flags less --resume, --wave-gate, --wave and --require-review. Every selected member is planned on the merged commit, the change set is stored under its digest, and the pull request’s gate is decided against it without a write to the gate ledger. Then it writes the merge record to _merges/<commit>.json on chant/lifecycle and pushes it. The record follows the merge-record schema of the workspace read contract.
The merge record keeps where the change came from in source: the pull request, the work items its Chant-Record: work:<id> trailers name, or a direct push. digest is the planned change set, and plan compares it with the approval (approved, changed, unapproved, nothing or plan-failed). approvedBy lists who approved it, and authorApproved lists an approver who wrote the change. components lists the selection.
pr-record refuses nothing and exits 0, unless a member failed to plan (exit 1). A plan that differs from the approved one still reports recorded. Its message names both digests, and the chant/record commit status fails. Without --pr the forge is asked which pull request merged HEAD, and a forge that errs leaves the record naming none. The report is pr-record.json, with stage: "record".
Both measure the change from the merge base of --base and HEAD, and select components the way fan-out --base does. Every selected member is planned before anything applies. A member that reads another’s output through stackOutput() is planned with the value that output has now.
The gate is pr-apply under the op pr-<n>, so one pull request’s approval never answers another’s. It binds the change-set digest of every planned member. pr-plan reads the gate ledger to report where the approval stands and writes nothing to it. pr-apply decides the gate against the digest it plans. When an approval stands for another digest, the plan changed after review. Then it applies nothing and exits 4 with both digests named.
A member that reads an output of another member is planned against what that member’s plan says it will expose, and lists a value the plan cannot say under unknownInputs (#3999). Before a member applies, pr-apply checks that each output it reads stands at the value its plan read. When one does not, it holds the member back and plans it again once the rest applied, by a round. The first approval covers the round when its plan touches only the components previewed, within each only the logical ids and actions previewed, and differs only in the inputs listed under unknownInputs; the report’s round then carries covered with the approved digest and the inputs filled in, and nothing more is asked. Any other round is decided at the gate <gate>-round-<n>, with the reason in notCovered. Without an approval of that plan the report ends waiting and pr-apply exits 3. pr-apply --resume and --wave-gate ask the same question of a plan made after something applied (#4422), so equivalent inputs give the same answer on a round, a resume and a wave. A member whose first plan was a hole with no preview has nothing the approval saw, so no later plan of it is covered. A dependent of a member the change plans has the details and an example of a covered and an uncovered round.
A failure part way leaves what applied, applied. pr-apply does not undo members that finished when a later one fails: the report marks each member applied, failed or blocked, and not-started in a group. --resume carries on from there. The run is not all-or-nothing.
Before it decides the gate, pr-apply stores the change set it planned on chant/lifecycle under its digest, each entry mapped onto the member’s graph (#4022). chant change-set show <digest> prints it after the job is gone, before an approval and after one. The mapping runs the member’s chant graph --format ir once per new digest. Source that fails chant lint has no graph to read. The change set is then stored with no nodes, and pr-apply prints a warning.
The plan changed after review, so nothing was applied. approved: jcs1-sha256:d181...; planned now: jcs1-sha256:cef9.... Read the new plan, and if it is right, approve it: chant approve pr-2 pr-apply --plan jcs1-sha256:cef9... --approver <you> --sign; then run the apply again.Each run writes three files under --output (default .chant/pr). pr-plan.json, pr-record.json or pr-apply.json is the report, under the pr-report schema. change-set.json is the change-set document, which chant change-set summary reads. pr-note.md is the note rendered from the report. It shows a row per member and the digest, then the approve command and the grouped summary.
pr-apply prints a line on stderr as each wave starts and as each component settles, with or without --events-json, so a job log shows the waves in order while they run:
wave 1/3: net net: appliedwave 2/3: app, api app: failed api: applied web: blocked by app, not run--report-url <url> copies the report, the change set and, with --events-json, the stage’s run events to <url>/<pr>/<commit>/, where a reader outside CI can fetch them. The events go up again as each wave and component settles, so the URL shows an apply in progress. <url> is s3://<bucket>/<prefix>, uploaded with the AWS CLI and the credentials in the job’s environment, gs://<bucket>/<prefix> or az://<account>/<container>/<prefix>, uploaded with chant’s own Google Cloud Storage and Azure Blob clients and the job’s credentials (#4554), or file://<directory>. A failed upload is a warning and the stage’s outcome stands. Pull request reports gives the layout.
With --events-json each stage also keeps its stream in a file on the host, as chant run events describes. In CI, set CHANT_RUN_EVENTS_DIR to a directory the job keeps as an artifact, such as .chant/pr/run-events, since a CI checkout’s git directory is gone with the job.
Pass --forge to post the note on the pull request and set the chant/plan, chant/record or chant/apply commit status. The note carries a marker per environment, so every push and the apply update one note. When pr-apply has no --pr, the forge names the pull request that merged HEAD. A forge that refuses a call is a warning, and the outcome stands.
With --forge, pr-plan and pr-post also ask when each scheduled watch or reconcile Op last ran, and the note warns of one whose cron fired twice since (#4289, Catch a Stopped Watch Schedule).
When the workspace has a goose, golang-migrate, clickhouse-migrations or Flyway member, pr-plan also lists each migration file the pull request adds to it, with the class of each statement, in the report’s migrations and in the note (#4407, Migration files on a pull request). It reads the files and applies nothing. A pull request that only adds migration files to a member with no component still gets the note.
--no-status posts neither. The generated plan passes it, since it runs the pull request’s code with no forge token (#4295). Then pr-post posts from the plan-note job.
components pr-post
Section titled “components pr-post”pr-post posts the plan’s note and its chant/plan status from the report a pr-plan --no-status wrote under --output (#4295). The generated plan-note job runs it, at the target branch’s commit, with the forge token the plan job never held. It loads no plugins and runs none of the change’s code.
chant components pr-post --pr 12 --head "$HEAD_SHA" --env prod --forge github --result "$PLAN_RESULT"The change’s code wrote the report, so pr-post reads it as data (packages/core/src/pr-post.ts):
- The flags name the pull request and its head, and the environment and member too. A report that names another refuses: the status fails and no note is posted (
readPlanReport). pr-postrenders the note again and writes each<!--after the first line as<!--(planNoteFor). A forged marker in the report then shows as text.--result failureorcancelled, the plan job’s own result, fails the status whatever the report says.
It exits 0 once it has posted, and a forge that refuses a call is a warning. The plan job’s result stays the one that fails the run.
| Flag | Meaning |
|---|---|
--pr <n> | The pull or merge request. Required. |
--head <sha> | The full commit the plan job checked out. Required. The status goes on it. |
--env <env> | The environment the plan was for. Required. |
--forge <kind> | github, gitlab or forgejo, with the client read from the job’s environment. Required. |
--member <name> | The workspace member whose plan it was. |
--output <dir> | The report directory. Defaults to .chant/pr. |
--result <result> | The plan job’s result, needs.plan.result on GitHub and Forgejo. |
--not-affected <argument> | The one word a product plan’s re-plan was narrowed to (#4963), empty for none. When the report or the hand-off says the change reaches nothing, pr-post replies that the argument is not affected and leaves the note and the status. |
--context <context> | The plan status’s context, a product plan’s statusContext (#5003), in place of chant/plan or the words’ <product>/<plan stage>. With --stale, one per --member, in the same order. |
With --open (#4328), pr-post posts for every open merge request into a branch, from a GitLab pipeline of that branch. The generated plan-note job runs it there, since a merge request pipeline runs the merge request’s own .gitlab-ci.yml and so holds no token (Keep the Forge Token From the Plan). GitLab names each merge request, its head and its newest pipeline’s plan job, plan or <member>-plan. pr-post reads pr-plan.json from that job’s artifacts, under --output from the repository root, and posts as above with the job’s result as --result (postOpenPlanReports in packages/core/src/pr-post.ts:202). A plan job that has not settled waits for the next run. A plan job whose chant/plan status already links to it is not posted again.
chant components pr-post --open --env prod --forge gitlab--open takes no --pr, --head or --result. --branch defaults to the pipeline’s CI_COMMIT_BRANCH. --plan-job <name> names the plan job to read when a product plan names its own (#5003, jobNames.plan).
Finishing an apply that failed partway
Section titled “Finishing an apply that failed partway”pr-apply --resume <file> keeps the same attempt record fan-out --resume keeps, with the change set the gate approved in it. The apply writes it before the first member runs and again as each component settles. When a member fails, repeat the same command on the same commit with the same file:
chant components pr-apply --base "$BEFORE_SHA" --pr 12 --env prod --resume .chant/pr/attempt.jsonThe re-run skips the components that applied and plans the rest against the outputs the approved plans read. It then checks each member it plans against the approved change set. A member is covered when it plans to the approved digest, or when every change it plans is one the approved plan made: the same address and action (or the create or delete left of an approved replace), and each attribute written to the approved value or to a value the approved plan knew only after apply. A sensitive value is covered only where the approved plan wrote it as sensitive too. When every member is covered and the approval still stands for the approved digest, the rest applies with no fresh approval, and the report’s resumed.applied and the note name what the earlier attempt applied.
Progress carries the same way it does for fan-out --resume: a component the earlier attempt applied is skipped only when its input digest is the same now. One whose input moved prints changed since the earlier attempt, is planned again and has to be covered by the approved change set like any member left over. The approval stays bound to the change-set digest.
The record carries nothing when it was written for another pull request, gate or commit, or for a change that selects other components, or when it keeps no input digests, or when the approval no longer stands, or when a member left over plans a change the approved plan did not make. Then pr-apply prints why and runs as it would with no record: it plans every member, and the new digest needs an approval of its own. A record whose change set does not hash to the digest it names carries nothing either.
Groups planned and applied as one
Section titled “Groups planned and applied as one”Composed runs says how each lexicon takes part, as a group, a preview or a hole. A capability that declares planGroup and runGroup can plan several components of a pull request in one call and apply them in one call (ws-107). A value one member creates then reaches the members that read it inside the same apply, with no round. Components join a group when each deploys in one step of that capability and reads join them. A component of another kind on a dependency path between two of them splits the group. The rest of the change plans wave by wave as above, under the same approval.
The report says what grouped (packages/core/src/components/pr-run.ts, prReport):
groupslists each group:capability,componentsin apply order, thewaveit ran in, the groupdigestfolded into each member’splanDigest, andreads, the values the group’s apply computes.fallbackslists each component that could have grouped and did not, with the capability’skindandreason, or core’ssteps,splitorcycle.- A member in a group carries
group, its index ingroups, and after an applygroupOutcome:applied,partial,failed,not-startedorno-changes.
For a, b reading a.id and c reading b.id, a plan report holds:
"groups": [ { "capability": "terraform-apply", "components": ["a", "b", "c"], "wave": 1, "digest": "jcs1-sha256:5d0e...", "reads": [{ "component": "b", "ref": "a.id" }, { "component": "c", "ref": "b.id" }] }]and the note says `a`, `b` and `c` plan and apply as one (`terraform-apply`, wave 1); `b` reads `a.id` and `c` reads `b.id`, known when the group applies. A set the capability refused is printed as Planned one by one, not as a group: `a`, `b` (`backend`): <reason>. A fallback of kind off, the capability’s own setting, is in the report and not in the note.
When the group’s apply stops part way, what applied stays applied. If b fails, the report lists b as failed. Member a is applied and c is not-started. The note says `a` applied and stays applied; `b` failed; `c` did not start. pr-apply --resume counts applied and no-changes members as applied. It plans the partial, failed and not-started members again, grouped again over what is left: b and c plan as a smaller group, or one by one when they no longer join or the capability refuses. They plan against the outputs a applied with. The smaller group’s digest differs from the approved one, so each member is checked by its entries and shape, as any resumed member is. Covered, they apply under the first approval. Not covered, the record does not carry and the new plan waits at the pull request’s gate for an approval of its own.
A gate per wave on merge
Section titled “A gate per wave on merge”pr-apply --wave-gate <name> applies the approved set a wave at a time (#4003). The first wave’s apply plans every member and decides the pull request’s gate against that digest, as pr-apply does without the flag. Approved, it applies wave 1 with those plans. Each later wave is planned against the outputs the waves before it left, and its plan is checked against the approved change set the way a resume checks a member left over.
When the approved set covers every member of the wave, the wave applies under the pull request’s approval. When it does not, the wave’s gate is <name>-wave-<k> under the op pr-<n>, bound to the change-set digest of the wave’s new plan. Nothing in the wave applies until someone approves that digest, and the apply exits 3 with each reason. A member whose capability returns no change set is covered only by the digest it was approved with, since there is nothing else to compare.
chant components pr-apply --base "$BEFORE_SHA" --pr 12 --env prod --wave-gate release --wave 1 --resume .chant/pr-resume/pr-apply.jsonchant components pr-apply --base "$BEFORE_SHA" --pr 12 --env prod --wave-gate release --wave 2 --resume .chant/pr-resume/pr-apply.jsonchant approve pr-12 release-wave-2 --plan jcs1-sha256:9b1f... --approver github:alice --signchant components pr-apply --base "$BEFORE_SHA" --pr 12 --env prod --wave-gate release --wave 2 --resume .chant/pr-resume/pr-apply.json--wave <k> runs one wave, for a CI job per wave. It reads the approved set and the waves that applied from the --resume record, which carries only while the pull request’s approval stands. It refuses with exit 1 while an earlier wave has work left or no record says the earlier waves applied. A wave past the change’s last exits 0. Without --wave the waves run in order until one waits at its gate. After a failed plan or apply, the later waves skip only what reads from the failure, and the note lists what was skipped (keep going past a failed member). Once the rest has applied, the job exits 1. Every wave after one that waits at its gate is held, and their jobs exit 3. The report’s status is wave-applied when a wave applied and a later one is still to run. Its waveGate and waves say which wave applied under which approval. A wave that waits refuses as wave-not-approved, or as wave-plan-changed when an approval of its gate stands for another digest.
The generated pull-request pipeline passes --resume .chant/pr-resume/pr-apply.json and keeps the file in the CI cache under the pushed commit, so re-running a failed apply job finishes it.
| Flag | Meaning |
|---|---|
--base <ref> | The commit the change is measured from. On a pull request, the target branch’s commit. After a merge, the commit the push replaced. Required, except with --green, where it is the fallback for the first apply to an environment. |
--green | pr-apply only. Apply the green commit at HEAD, measured from the green commit last applied to --env (_green-applies/<env>.json on chant/lifecycle), under the approved plans of the merges between when they cover the plan, else at the gate under op green-<sha>. Takes no --pr. A HEAD with no counting ci/green tag is refused, and the commit last applied exits 0. See which commit applies. |
--before-merge | pr-apply only, chant 0.124.42 and newer (#4301). Apply open pull request --pr at HEAD, its head, before it merges. Needs --forge. It refuses with before-merge-off (exit 1) unless the declaration at base sets ci.workflow to apply-before-merge, and with requires-unmet (exit 3) unless the forge says the pull request is approved, mergeable, undiverged and green. When the trust policy at base has a ref gate rule for the target branch (--branch, else the pull request’s target or the branch the job runs on), green includes the gate’s status (#4966); a policy at base that can’t be read stops the apply (exit 1). Both run before any of the head’s code loads. Then the pull request’s gate decides as on merge, and under ci.locks it takes apply locks. Takes no --green or --wave-gate. See apply a pull request before it merges. |
--pr <n> | The pull or merge request. Required for pr-plan. |
--target <address> | pr-plan only (#4620). Narrow the plan to this address, passed to each planned member’s capability: -target for a Terraform root, --target for a Pulumi stack. A bare address narrows every member the pull request plans. --target <component>:<address> narrows that component alone. A value is read as a component’s when the text before its first : is a component’s name, so a Pulumi URN stays a bare address. Repeatable. The targets join each member’s digest, so an approval of the narrowed plan covers no other. A member whose capability cannot narrow, such as sql-migrate or cfn-deploy, is refused by name before anything plans (exit 1). pr-apply and pr-record take no --target. |
--refresh | pr-plan only (#4627). Refresh each member’s state before it plans: --refresh on a Pulumi stack’s preview (and on stock pulumi up), and what a Terraform root’s plan does already. The flag joins each member’s digest. A member whose capability cannot refresh is refused by name before anything plans (exit 1). The pull request loop’s refresh option, and --refresh in the preview comment, run the plan with it. |
--target-dependents | pr-plan only, with --target (#4627). Plan what depends on each target too: --target-dependents on a Pulumi stack’s preview. Terraform has no such flag, so a Terraform root is refused by name with the reason, and its dependents are named with --target. It joins the digest as --refresh does. |
--env <env> | Environment each member deploys into. Defaults to local. |
--gate <name> | The gate’s name. Defaults to pr-apply. |
--forge <kind> | github, gitlab or forgejo. Post the note and the status, with the client read from the CI job’s environment. |
--require-review | pr-apply only. Count an approval only from someone with a standing approving review on the pull request, named the way the forge names them (github:<login>, gitlab:<login>, forgejo@<host>:<login>). Needs --forge. |
--member <name> | A workspace member’s loop, run in the member’s directory. The gate is recorded under pr-<n>-<member>, the note and the statuses carry the member’s name, and the report gains member. The name must be the member that owns the current directory. The member’s generated pipeline passes it. |
--resume <file> | pr-apply only. Write the attempt record here, and finish an earlier attempt it records under the same approval. See above. |
--wave-gate <name> | pr-apply only. Apply a wave at a time, each planned after the one before it applied. A wave whose plan the approved change set covers applies under the pull request’s approval, and one whose plan moved waits at <name>-wave-<k>. See a gate per wave on merge. |
--wave <k> | pr-apply --wave-gate only. Run wave k and no other, reading the approved set and the waves that applied from --resume. |
--output <dir> | Where the report, the change set and the note go. Defaults to .chant/pr. |
--seed-outputs <file> | Outputs to use instead of reading them from the deployed estate, as on fan-out. Without it, the plan reads the deployed outputs of every dependency a planned member names that the change does not plan, and the report lists them under deployedOutputs. A dependency the change plans is read from its plan instead, listed under plannedOutputs (#3999). |
--events-json | Stream the stage’s events to stdout, one run-event.schema.json line each: a plan phase with a step per component, the gate’s decision as a gate phase, and on pr-apply the apply’s waves and components, a component it did not start settling blocked or already-applied. This is the stages’ stream; they take no --progress-json. Refused beside --json, which prints the report to stdout too. See run events. |
--report-url <url> | Copy the report, the change set and, with --events-json, the events to <url>/<pr>/<commit>/, an s3:// or file:// URL. See above. |
--json | Print the report on stdout. |
components pr-env
Section titled “components pr-env”An environment per open pull request, pr-<n>, derived from ci.prEnvironment.template in the workspace declaration at --base (#4298). See an environment per pull request for the setup.
pr-env up measures the change as pr-plan does and plans it into pr-<n>, with the build parameter ownership.env reads set to pr-<n>. An empty plan applies at once. Any other applies once an approval of its digest stands under gate pr-env on op pr-<n>, and until then the command exits 3. A project whose ownership marker could not name pr-<n> is refused, as is a config that does not declare the template or cover pr-<n>. Each apply appends an up record to _pr-envs/records.jsonl on chant/lifecycle, which names the marker and the expiry. With --no-push the record goes to pr-env-record.json under --output instead. The ci.hooks at base run around the plan and the apply. The note shows each component’s site in pr-<n>, carried over from the template’s (#4330).
pr-env post is the generated pipeline’s second half (#4295). It runs at the target branch’s commit, takes the report and the record up --no-push left under --output, and checks them as data. A kept record gets the post job’s own commit, actor and expiry, and is appended to chant/lifecycle. Then the note and the status are posted.
pr-env down tears down what carries the marker { stack, env: "pr-<n>" } that the environment’s record names, after checking the record is this pull request’s. It drops any candidate with another marker before anything is deleted, and appends a down record. The lexicons tear down what they own, and the command ci.prEnvironment.teardown names tears down the rest, such as a Terraform root’s copy (#4330). An environment whose teardown left something stays live. With no live record it exits 0.
pr-env sweep runs down for each live environment whose TTL passed. With --forge it also runs down where the pull request is no longer open.
The report goes to pr-env-<stage>.json under --output, beside pr-env-note.md. Given --forge, the note is posted on the pull request too, with a chant/pr-env commit status.
| Flag | Meaning |
|---|---|
--base <ref> | up only. The pull request’s target commit, where ci.prEnvironment is read. Required. |
--pr <n> | The pull or merge request. Required for up and down. |
--reason closed|expired | down only. Why, as the record says. Defaults to closed. |
--forge <kind> | github, gitlab or forgejo. Post the note and the status; sweep also reads whether each pull request is open. |
--member <name> | A workspace member’s environment, run in the member’s directory. The op is pr-<n>-<member>. |
--output <dir> | Where the report and the note go. Defaults to .chant/pr-env. |
--no-push | up only. Write the record to pr-env-record.json under --output, for pr-env post, and touch no chant/lifecycle. |
--head <sha> | post only. The commit up applied from, which the record and the status name. Required. |
--result <result> | post only. The up job’s result, said in the note when it handed on no report. |
--json | Print the report on stdout. |
components promote
Section titled “components promote”Deploy the artifact digests one environment’s release ledger records to another environment, without a build.
chant components promote --to prod --dry-runchant components promote --from staging --to prod --dry-runchant components promote --from staging --to prodchant components promote --from staging --to prod --component search-service --digest sha256:9fae3d7c...chant components promote --from staging --to prod --digest search-service=sha256:9fae3d7c... --digest web=sha256:41c0...Without --component, every component this checkout declares that has a release in the --from ledger is promoted, each at its latest recorded digest. A recorded component the checkout no longer declares is listed as not promoted and left alone. --component <name> promotes that one component, and --digest picks an earlier release of it. Without --component, --digest <component>=<digest> can be repeated. It promotes exactly the components it names in one run, in dependency order, each at the release that recorded that digest. That is how a generated promote job promotes the releases its own pipeline run built, since the latest release in --from may belong to another run. A digest the --from ledger never recorded for the component fails before anything runs, and the error lists the digests it did record. So does <component>= with no digest, which is what a pipeline passes when the job that deployed the component recorded no release.
A promote runs the component’s deploy composition against the --to environment with its build-time steps taken out: docker-build, zip-package, jvm-build, generate-sbom and extract-config-bom. Everything else runs the way chant run --components <name> --env <to> would run it:
- The publish step still runs. It moves the archived bytes to the target environment, which is how the build archive promotes by digest. Its output is checked against the recorded digest, and a publish that yields any other digest fails the component before the steps after it run. That happens when the archive on disk is not the one the source release was built from, so run a promote where that archive is present: the job that built it, or one that restored it. A pipeline from
chant build --components --generate <lexicon> --promote-to <env>restores it for you: each component job uploads its archive, and a separate promote job downloads it before it runs the promote. This works for github, gitlab and forgejo. - Gates run. A gate in the composition stops the promote with exit 3 and the
chant approveline, the same as any deploy to that environment, and running the same promote again after the approval continues past it. The approval is bound to the--toenvironment and to this promote’s plan, which includes the digest being promoted. An approval for a plain deploy, or for a promote of another digest, does not pass the gate. - The remaining steps run against the target environment as they are written in this checkout. The artifact comes from the source release but the deploy steps come from here, so the promote warns when this checkout is not the commit the artifact was built from.
Promoting a release
Section titled “Promoting a release”--release <label|digest> deploys under a release cut from a green commit (#4026). The release must have a target for --to. Each template a promoted component’s deploy reads is then the one that target recorded, not the file in this checkout. Its bytes are read from chant/lifecycle and checked against the target’s digest, the way the publish output is checked against the recorded digest, and written under .chant/release-templates/<digest>/ for the step to read, then removed when the promote finishes. The promote refuses before anything runs when a template’s bytes do not hash to the target’s digest, when they are missing from the branch, and when the deploy reads a template the target does not record, which means this checkout’s deploy is not the one the release was compiled from. Each deploy record the promote writes carries releaseDigest, naming the release, and chant release list then lists --to among the environments that run it. A release cut from a commit that has since been revoked is refused with release-revoked before anything runs (#4033); the revoked tags are read locally, so fetch them with git fetch origin --tags. See revoked releases. A release of a project with no components has no component to deploy, so --release refuses it and names chant release export, which writes the recorded build output for the project’s own deploy to read. Without --release a promote works as before.
chant components promote --to prod --release v1.4.0 --dry-runThe promote also warns when the deploy it promotes was built from other bytes than the release’s. It reads the build manifest the source deploy record names (manifestDigest) and compares the entry at each of the release’s artifact paths with the release’s artifactDigests. A source deploy that names the release in releaseDigest matches. This is a warning rather than a refusal because the environment promoted from was built by its own chant run --components, and an image build is not reproducible, so its digest differs from the cut’s for the same commit.
The release gate
Section titled “The release gate”A gate a promote under a release reaches is a release gate (#4045, ws-104 questions 2 and 6). When the promoted compositions declare a gate, the promote first plans the release’s change set for --to and stores it on chant/lifecycle under its digest, which it prints. Each gate then binds the release in releaseDigest, the environment in environment and the change-set document’s digest in planDigest. An approval counts only when all three match.
Every release gate is recorded under the op release, whichever component reaches it, with the gate name its composition gives it. Components that use one gate name share one gate per environment, so one approval of the release’s change set passes all of them:
chant approve release prod-release --env prodThe approval copies the release, the environment and the digest off the pending fact. chant approve refuses a release gate whose release was cut from a revoked commit, with release-revoked, and one whose release file can’t be read, with release-unreadable. An approval for another release, another environment or another change set does not pass the gate. --component promotes a subset of the release, whose change set has another digest and needs its own approval. A change set with a provisional member is refused before anything deploys, since no approval covers it, and so is one with a member that failed to plan.
A component whose step can plan, such as terraform-apply, is planned by that step. Any other component is compared with what --to runs now, its latest deploy record and the release that record names: the artifact digest, each template the release records for the component, and the target’s parameters. Each value that differs is an attribute of one update entry, or of a create when --to has no deploy of the component. A deploy that names no release, or names one that can’t be read, is a hole, since nothing says what the environment runs.
An environment whose change set is empty passes its gates without an approval. A change set is empty when every member planned with no hole, and no entry is anything but no-op or read. A failed or provisional member is never empty. The promote writes a resolution for each gate with empty: true, the actor running the promote in resolvedBy, and the release, environment and digest. The gate counts it only after it reads the stored change set back and finds it empty, and quorum and signing rules don’t apply to it. The deploy record for each component then names the release, so a flag flip for prod alone moves through staging with no approval, and staging’s ledger still says which release it runs. A promote whose compositions declare no gate plans and stores nothing.
Planned outputs and rounds
Section titled “Planned outputs and rounds”A merge deploys nothing (#4168), so the rule a pull request’s apply follows for a dependent (#3999) is the promote’s. When a promote under a release deploys a component and one that reads its output through stackOutput(), the release’s change set plans the dependent against the value the upstream’s plan says it will expose, not the value it has now. A reference the upstream’s plan can’t say is printed before the run as known only once it applies. A dependency the promote does not deploy is read as it stands, as before.
A promote forms groups as a pull request’s run does (Groups planned and applied as one, #4465): each group plans with one call, its digest is in the change set the release gate binds, and it applies with one call, so a read between two of its members needs no round. The --json output carries groups and fallbacks, and each group’s outcomes. Under --wave-gate no group forms; each component that would have joined one falls back with kind wave-gate. Every other component plans on its own.
The promote then runs a wave at a time. Before a wave runs, a component whose plan read an upstream value that the run left as another value is planned again against what stands. If the approved change set already covers the new plan (the check a pull request’s resume makes), nothing more is needed. If not, the promote stops with exit 3 at <gate>-round-<n>, numbered from 2, which only an approval of the new plan’s digest passes:
chant change-set show <digest>chant approve release prod-release-round-2 --env prodchant components promote --to prod --release v1.4.0When a round’s components declare no gate, nothing can approve the new plan, so the promote stops there. A round whose plan has a provisional member, or one that failed to plan, is refused the same way.
A gate per wave (--wave-gate)
Section titled “A gate per wave (--wave-gate)”--wave-gate <gate> checks every wave after the first (#4157’s rule). Each one is planned again against what the waves before it left. A wave the approved change set covers applies under that approval. One it does not cover waits at <gate>-wave-<k>, one gate for the whole wave, bound to that wave’s digest:
chant components promote --to prod --release v1.4.0 --wave-gate prod-releasechant approve release prod-release-wave-2 --env prod--wave-gate needs --release and a composition that declares a gate.
Planning only (--plan-only)
Section titled “Planning only (--plan-only)”--plan-only plans the release’s change set for --to and stores it as a real promote does, then prints it and stops (#4037). Nothing is deployed. The gate ledger gets no pending fact and no empty pass, and the environment’s ledger gets no deploy record. The --json form looks like this.
{ "env": "prod", "releaseDigest": "jcs1-sha256:3f…", "label": "v1.4.0", "op": "release", "gates": ["prod-release"], "changeSet": "jcs1-sha256:9b…", "empty": false, "components": ["api", "web"]}changeSet and empty are null, and gates is empty, when no promoted composition declares a gate. A promote that follows binds the same change set unless what it plans against has moved. chant workspace train promote --gate uses this to gather every member’s change set before any member deploys. --plan-only needs --release.
Under a train’s workspace gate
Section titled “Under a train’s workspace gate”When chant workspace train promote --gate <name> starts the promote, CHANT_WORKSPACE_GATE names that workspace gate. A release gate the member’s own approvals don’t pass then counts the workspace gate’s approval, but only under three conditions. The approval must cover this member’s gate with the change set this promote planned, the environment and the release digest. Its covers must still hash to the approved digest. The member must set acceptWorkspaceGates: true in chant.workspace.json at base. Nothing is written to the member’s gate ledger. The deploy record names the workspace approver as the gate’s approver.
Resuming
Section titled “Resuming”A stop after anything applied leaves a resume record at .chant/promote/<to>.resume.json in the member’s directory (or at --resume <file>). Those components are skipped next time, and what is left plans against the outputs the record kept. If the first approval covers that plan, it still holds. A finished promote deletes the record, and a record for another release or environment is ignored.
Pull request approvals
Section titled “Pull request approvals”A promote under a release lists the pull requests the release carries into --to, from the merge records of the release commit’s first-parent history since the commits --to runs (at most 200): for each, where it came from and how its plan stood against its approval. They are shown beside the release gate and never counted by it. With --json they are under pullRequests.
Some compositions cannot be pinned to one recorded digest, and a promote refuses them before anything runs: a component with no publish step (nothing in its deploy carries the digest), one with more than one publish step (a release record carries one digest), and one whose remaining steps read an output of a removed build step, such as @Build.archivePath.
Under --release, a component with no publish step is promoted when the release records its templates, since the deploy reads them from the release and not from the checkout (templatesPinned in withoutBuildSteps, packages/core/src/components/promote.ts). Its release record carries the digest of those templates. A chant run --components --release of it records the same digest, which is how promote and rollback --release find what an environment runs. A template-only cfn-deploy is the usual case.
These capabilities roll back by release: every one whose deploy reads files the release records (cfn-deploy and the other template fields, helm-upgrade, kustomize-apply, the sync steps), every one with a publish step, terraform-apply, and pulumi-up for Pulumi and plunge stacks (#4542). A release records a Terraform root’s files, as release cut records it, and a promote or rollback under it plans the recorded root against the environment and binds the release gate to that plan. An empty plan passes without an approval, as an empty change set does. A root that keeps local state is not recorded and rolls back with chant lifecycle rollback --to. A Pulumi stack rolls back the same way: the release records the stack’s directory, and the promote or rollback previews the recorded program against the stack and binds the release gate to that preview. A stack whose backend is a file:// path inside its own directory is not recorded, for the same reason as a root on local state.
Promote, rollback and redeploy set CHANT_ENV to the environment they deploy before the components load, as --env does for chant run. A component that names its stack from it, such as trunk-curated-${env}, deploys to the target’s stack.
A dependsOn edge to a component outside the promotion is dropped, as a single-component chant run --components drops it. --seed-outputs <file> loads the outputs such a dependency produced, for stackOutput() references into it.
The promote appends one record to the --to ledger for every component it deployed. The record carries the source release’s digest, git sha and archive digests, a fresh run id and actor, the approver of any gate it passed, and promotedFrom, which names the source release:
{ "component": "search-service", "env": "prod", "digest": "sha256:9fae3d...", "gitSha": "a1b2c3d", "runId": "4822", "timestamp": "2026-07-03T09:12:40.000Z", "actor": "octocat", "promotedFrom": { "env": "staging", "runId": "4821", "timestamp": "2026-07-02T18:04:11.000Z" }, "version": 1}A component that did not finish gets no record. The components that did deploy keep theirs. A ledger write that fails after a deploy exits 1 and says the deploy happened.
When a promote fails partway, the component’s in-run unwind undoes the steps it ran, and the --to ledger still records the release that was there before. If the unwind could not put everything back, chant components redeploy <to> --component <name> deploys that recorded release again. Once the cause is fixed, running the same promote again is the other way forward.
| Flag | Meaning |
|---|---|
--from <env> | The environment whose release ledger holds the digests. Defaults to the environment before --to in the member’s promotion order; required when the member declares none. |
--to <env> | Required. The environment to deploy them to. Must differ from --from. |
--allow-skip | Promote past a step of the promotion order, for example dev straight to prod. |
--release <label|digest> | Deploy under this release: the templates come from its target for --to, checked against their digests, and each record names the release in releaseDigest. See Promoting a release. |
--component <name> | Promote only this component. |
--digest <sha256:...> | With --component, promote this recorded digest rather than the latest one. |
--digest <component>=<sha256:...> | Without --component, promote only the named components, each at this recorded digest. Repeatable. chant run --components --digest-file writes the value. |
--wave-gate <gate> | Under --release, check each wave after the first and wait at <gate>-wave-<k> for one the approval does not cover. See A gate per wave. |
--resume <file> | The resume record to read and write. Defaults to .chant/promote/<to>.resume.json. See Resuming. |
--dry-run | Print the plan (each component, its digest, the source release and the steps that will not run) and deploy nothing. |
--json | Emit the plan, the run result and the records written as one JSON document on stdout. A promote that ran in rounds adds stages, plannedOutputs and unknownInputs. |
--seed-outputs <file> | Load outputs from dependencies outside the promotion. Repeatable. |
--run-id <id> | Run id for the new records. Defaults as components release does. |
--actor <name> | Who ran the promote. Defaults as components release does, and must resolve before anything deploys. |
--events-json | Stream the deploy’s events to stdout, one run-event.schema.json line each, named by the run id the new records carry. Rollback and redeploy take it too. |
The promotion order
Section titled “The promotion order”The order of the environments array in the member’s chant.config.ts is its promotion order. With it declared:
--to prodwithout--fromreads the environment beforeprodin the array.- A
--fromthat is more than one step behind--tois refused, and nothing is deployed. The refusal names the skipped steps and ends with a fix line. Pass--allow-skipto promote it anyway. - A
--fromor--tothat is not a step of the order, such as apr-42environment matched by apr-*pattern, is not judged. Without--from, a--tooutside the order is refused, since there is no step before it.
The refusals carry a stable code in square brackets at the end of the message:
| Code | When |
|---|---|
promote-skips-environment | --from is more than one step behind --to, and --allow-skip was not given. |
promote-no-previous-environment | --from was left out and --to is the first step of the order. |
promote-to-not-in-order | --from was left out and --to is not a step of the order. |
chant build --components --generate --promote-to applies the same rule when it writes the promote job, so a skip fails at generation time and --allow-skip on the build is passed to the job. A member that declares no environments has no order. Promote requires --from and refuses nothing, as before. A step marked canary: true is recorded in the order and does nothing else yet.
components rollback <env>
Section titled “components rollback <env>”Redeploy an earlier release of one component in <env> from the digest its release record carries. With --release, redeploy every component of an earlier release at once.
chant components rollback prod --component search-service --dry-runchant components rollback prod --component search-servicechant components rollback prod --component search-service --digest sha256:4c1e0b...chant components rollback prod --release v1.4.0By default the rollback restores the newest release in <env>’s ledger with a digest other than the current one. A stack or root applied through op waves has a record there too, which names a release when one cut from the applied commit records it (#4615, op waves). A redeploy of the current digest therefore does not count as an earlier release. With --digest, it restores the latest release that recorded that digest instead. Naming the digest that is already current, or one the ledger never recorded for the component, is refused before anything runs.
The rollback runs the component’s composition against <env> with its build steps taken out, as a promote does, and it also replaces the publish step with a recorded-digest step that returns the recorded digest. The environment received that artifact when the release was first deployed, and the build archive it came from is usually gone by now. The recorded digest has to still be where that release put it, so a registry that has expired the image will fail the apply. Only the digest is known, so a composition whose steps read another publish output, such as @Publish.uri, is refused. The other refusals are the ones promote makes: no publish step, more than one, or a step reading a removed build step’s output.
A component with no publish step, such as a Terraform root, is recorded with the digest of the files its release recorded (#4222). --component rolls it back under that release (#4542): its deploy reads the release’s files, a terraform-apply step plans the recorded root against <env>, and the gate binds that plan as Rolling back a release describes.
Gates in the composition apply to a rollback exactly as they do to a deploy, including exit 3 and the chant approve line. The approval is bound to <env> and to the release being restored, so one given for a deploy or for another rollback does not pass the gate.
When the rollback succeeds, <env>’s ledger gains a record with the restored release’s artifact identities and a restores field naming that release. Run id, actor and approver are filled in as a promote fills them: When the release restored came from a release, the new record copies its releaseDigest, so the environment still reads as running that release (#4043).
{ "component": "search-service", "env": "prod", "digest": "sha256:4c1e0b...", "restores": { "env": "prod", "runId": "4790", "timestamp": "2026-06-28T11:20:05.000Z" }}This is a different mechanism from the saga unwind inside a single run, which undoes that run’s own steps when it fails. See Rolling back to an earlier release for how the two relate.
A rollback always moves to a release other than the current one, so it cannot recover from a deploy that failed partway. A failed deploy records nothing, and the ledger still names the last good release as current while the environment may be running part of the failed one. components redeploy puts the current release back. The same applies when a rollback itself fails: the ledger still names the release that was current before it.
A rollback or a redeploy that would put back a release cut from a revoked commit is refused before anything runs, with release-revoked, as promote --release refuses one (#4033). The refusal names a release to restore instead: the newest one <env> ran that is still kept and not revoked.
Rolling back a release
Section titled “Rolling back a release”--release <label|digest> restores every component of an earlier release in one run (#4035). It is a promote of that release into <env>, and it runs the way promote --release runs:
- Each component of the release is restored at the newest record in
<env>’s ledger that names the release, so the digest deployed is the one<env>ran from it. Its deploy reads the templates the release recorded for<env>, checked against their digests. - When a composition declares a gate, the release’s change set is planned against what
<env>runs now and stored onchant/lifecycle, and every gate binds it under the oprelease. An approval of it counts only for this release and<env>, and an empty change set passes without one. - One change set covers the whole rollback, so one approval passes it.
A release that <env> never ran one of its components from is refused, since no recorded digest says what to restore; promote it instead. A release <env> already runs is refused, unless a run left one of its components failed or gated (see When a deploy applies partly). Then the rollback is what puts that component back, and the component is a hole in the change set, so its gate waits for an approval. A revoked release is refused with release-revoked. A component of the release this checkout does not declare is listed and left alone. --release takes neither --component nor --digest.
When a deploy applies partly
Section titled “When a deploy applies partly”A promote, rollback or redeploy that deploys some components and not others, or fails on one, appends a deploy outcome to <env>/outcomes.jsonl on chant/lifecycle, beside the environment’s releases.jsonl and under the same member prefix (#4035). It names each component the run planned and what happened to it: deployed, failed, gated (stopped at a gate after the steps before it ran) or not-run, with the digest and release the run was deploying. A run that stops at a gate before deploying anything writes none, because the environment did not change. The command prints which components ended which way and the redeploy line for each one it left failed or gated, and --json gains outcome.
chant workspace status reads the outcomes with the ledger and shows the environment as mixed until each of those components has a newer release record: a redeploy, a rollback, or the same command run again.
| Flag | Meaning |
|---|---|
--component <name> | The component to roll back. Required unless --release is given. |
--digest <sha256:...> | Restore the release that recorded this digest, rather than the one before the current release. Needs --component. |
--release <label|digest> | Restore every component of that release through the release gate. See Rolling back a release. |
--requested | Carry out the rollback a pipeline stage requested after a failed verify or soak, once gate <stage>-rollback is approved. It restores the members the request names to the release it names. See Roll back. |
--dry-run | Print the release that would be restored and the steps that will not run, and deploy nothing. |
--json | Emit the plan, the run result and the record written as one JSON document on stdout. |
--seed-outputs <file> | Load outputs from dependencies. Repeatable. |
--run-id <id> | Run id for the new record. Defaults as components release does. |
--actor <name> | Who ran the rollback. Defaults as components release does, and must resolve before anything deploys. |
components redeploy <env>
Section titled “components redeploy <env>”Redeploy the release of one component that <env>’s ledger records as current. Use it after a deploy that failed partway, from chant run --components, components promote or components rollback.
chant components redeploy prod --component search-service --dry-runchant components redeploy prod --component search-servicechant components redeploy prod --component search-service --digest sha256:9fae3d7c...A deploy writes its release record only after it succeeds, so a failed one leaves the ledger on the last good release. The run’s own unwind undoes the steps it ran, but a best-effort compensation, or a crash during the unwind, can leave the environment running something else. components rollback cannot help here, because it refuses the release that is already current.
The redeploy picks the newest record for the component in <env> and runs it the way a rollback runs an earlier release. Build steps are taken out and the publish step is replaced by a recorded-digest step, so a composition a rollback refuses is refused here too. A gate in the composition stops a redeploy the same way it stops a rollback, with exit 3 and the chant approve command to run before trying again. Its approval counts only for <env> and the current release. An approval given for a plain deploy is refused, and so is one given while another release was current. Since the composition it runs is exactly what a rollback to that release runs, approving either one covers both. With --digest, the redeploy checks that the digest is the current one and refuses anything else before it runs, which catches a deploy recorded since you last read the ledger. An earlier digest is a job for components rollback --digest, and the error says so.
A successful redeploy appends a record to <env>’s ledger that carries the current release’s artifact identities, plus a redeploys field pointing at that release. The current digest stays the same, and the record shows who put the release back and when. A record that restores a deploy made under a cut carries that deploy’s releaseDigest as well:
{ "component": "search-service", "env": "prod", "digest": "sha256:9fae3d7c...", "redeploys": { "env": "prod", "runId": "4821", "timestamp": "2026-07-02T18:04:11.000Z" }}A redeploy that fails writes no release record, like any other deploy, and can be run again. It does append a deploy outcome naming the component failed, so the environment reads as mixed until the component is recorded again (see When a deploy applies partly).
| Flag | Meaning |
|---|---|
--component <name> | Required. The component to redeploy. |
--digest <sha256:...> | The digest you expect to be current. Anything else is refused. |
--dry-run | Print the release that would be redeployed and the steps that will not run, and deploy nothing. |
--json | Emit the plan, the run result and the record written as one JSON document on stdout. |
--seed-outputs <file> | Load outputs from dependencies. Repeatable. |
--run-id <id> | Run id for the new record. Defaults as components release does. |
--actor <name> | Who ran the redeploy. Defaults as components release does, and must resolve before anything deploys. |
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success (for fan-out and pr-apply, every selected component applied; pr-plan exits 0 whenever every member planned) |
| 1 | Error (missing required flags, unresolvable actor, concurrent ledger write, no manifest found, an export entry missing on disk; for fan-out, a component failed, or the change signal was unusable; for promote, rollback and redeploy, a digest missing from the ledger or not current, a composition that cannot be pinned, or a failed deploy) |
| 3 | pr-env up: no approval stands for the environment’s plan, so nothing applied. pr-apply: refused, and nothing applied. No approval stands for the plan, the approver has not approved the pull request, or no pull request merged the commit. fan-out, promote, rollback and redeploy: stopped at a gate nobody has approved. For fan-out with --gate nothing ran, and with --wave-gate nothing in the gated wave or after it ran; for the others the steps before the gate ran, and only components that finished were recorded. pr-apply: a member was planned again after an upstream applied, and no approval stands for that plan; the rest applied (#3999). fan-out, pr-apply, promote, rollback and redeploy: a step refused a plan that moved since it was approved, and applied nothing. The components before it applied and are recorded (#3997). |
| 4 | pr-apply: the plan changed after review, so nothing was applied. |
See Also
Section titled “See Also”- Observability — the release ledger, build-ledger referrer discovery, and the reconciliation model this command implements.
chant lifecycle— snapshots,diff --live, andplan, whose ownership/drift classificationcomponents status --livereuses.- Build Archive — the content-addressed manifest and digest identity the release ledger joins against, and what
components exportmaterializes. - Orchestration covers the derived fan-out as a model, and where the order comes from.