Skip to content

rollback: a stage whose verify fails after promote can request its rollback #5328

Closed

Description

@lex00

When a verify step fails after a promote, the environment stays as applied, or "mixed", and chant workspace status prints the rollback line for a person to run (ci/roll-back.mdx). chant can already roll an environment back to the release it ran before: components rollback --release (runComponentsRollback in packages/core/src/cli/handlers/promote.ts). lifecycle/rollback.ts is a source revert and is not the path here.

Add an opt-in per stage: when its verify or soak (#5326) fails, request the rollback to the previous release. The rollback goes through the stage's gate like any other change; the request is recorded and waits for approval unless the stage's policy lets it pass with an approver. The default stays a hold.

Needs #5324 and #5326.

Acceptance criteria

  • onVerifyFail: "rollback" on a stage; the default is "hold".
  • A failed verify or soak writes a rollback request bound to the previous release's digest, sends a chant.notify/v1 event of a new kind, and exits 3.
  • The rollback applies only after its gate passes, and the ledger links it to the failure.
  • A stage with no earlier release, or whose earlier release is revoked, holds and says which.
  • A stage whose members have mixed holds (some rolled back, some not) reports each member's state and requests rollback only for the members that applied.
  • onVerifyFail: "rollback" is refused at build on a stage containing a sql-migrate step, or a step whose kind cannot restore a release (no releaseInputs, so components rollback --release has nothing to apply). noRollback alone does not refuse: terraform-apply and pulumi-up declare rollbackPolicy: "needs-opt-out", so their steps carry noRollback, and both answer releaseInputs, which is how this rollback works. The refusal names the step and why.
  • Tests for pulumi-up and terraform-apply stages, where the rollback is a forward apply of the earlier release.
  • Docs in ci/roll-back.mdx.
  • The capability is exported with a *_FLOOR constant naming the chant release that carries it, so products can check or pin to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:delivery

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions