Documentation Index
Fetch the complete documentation index at: https://docs.compartment.dev/llms.txt
Use this file to discover all available pages before exploring further.
compartment rollback reverts a project environment to a previous deployment. Use it when a recently promoted deployment shows problems — errors, failed health checks, or unexpected behavior — and you need to restore the last known good version quickly. By default, Compartment selects the most recent successful deployment that preceded the current active one. You can also target a specific deployment by ID using --to.
Usage
Options
| Flag | Type | Default | Description |
|---|---|---|---|
--env <name> | string | — | Name of the environment to roll back. If omitted, Compartment uses the default environment defined in compartment.yml. |
--project <name> | string | — | Project slug to target. If omitted, Compartment reads the project name from compartment.yml in the current directory. |
--service <name> | string | — | Limit the rollback to a single named service. If omitted, all services in the environment are rolled back together. |
--to <deployment-id> | string | — | Roll back to a specific deployment ID rather than the automatically selected previous deployment. |
--verbose | boolean | — | Print rollback progress events to the terminal as they occur. Only applies when --output is text. |
--output <format> | text | json | text | Output format. Use json for machine-readable results in CI pipelines. |
Examples
Roll back the default environment to the previous deployment
Roll back a specific environment
Roll back to a specific deployment by ID
If you run
compartment rollback without --project, the command looks for a compartment.yml file in the current directory. Run from your repository root, or pass --project explicitly when running from another location.