Skip to content

Implement deploy rollback - #1744

Merged
gcirclest merged 1 commit into
mainfrom
rollback-comm
Aug 17, 2026
Merged

Implement deploy rollback#1744
gcirclest merged 1 commit into
mainfrom
rollback-comm

Conversation

@gcirclest

@gcirclest gcirclest commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Adds circleci deploy rollback <target-version> over POST /api/v3/projects/{id}/rollback, covering every request field.

$ circleci deploy rollback 1.2.0 --component web-frontend --environment production
Roll back web-frontend in production from 1.3.0 to 1.2.0? [y/N] y
✓ Rolling back web-frontend in production from 1.3.0 to 1.2.0
Pipeline run 8f0b… — follow it with: circleci run get 8f0b…
  • --component / --environment take a name or a UUID. The endpoint is id-only, so names resolve through the deploy list endpoints; an ambiguous name reports the candidates rather than picking one.
  • --from (current_version) defaults to the version the API reports as deployed there. The API re-checks it, so a wrong inference fails the rollback instead of moving the wrong version.
  • --force plus a prompt, like run cancel. Non-interactive without it exits 6 and never sends the request.
  • data.id is either a pipeline run or a release-agent command, polled in different places, so the output names which one and how to follow it.
  • No --dry-run, and the version is positional rather than a --to flag: --help sits at exactly the 40-line budget and overBudget is at its 25-entry cap.
  • Errors: 409 → already in progress (exit 4), 400 → rejected (exit 2), 404 → not found with a --namespace hint (exit 5).

12 acceptance tests cover name resolution with an inferred --from, every optional field asserted through the request recorder, both rollback types, --json, bad input and each error status. The --force-refused case asserts the POST never left the CLI.

@gcirclest
gcirclest marked this pull request as ready for review August 17, 2026 08:41
Add `circleci deploy rollback <target-version>` over the V3 project rollback
endpoint, POST /api/v3/projects/{id}/rollback.

--component and --environment accept a name or a UUID. The endpoint addresses
both by id, so a name is resolved through the component and environment list
endpoints first; an ambiguous component name reports the candidate ids rather
than picking one.

--from (current_version) is optional. Omitted, it is read from the component's
versions filtered by the environment, which the API returns most recently
deployed first. The API re-checks it, so a stale inference fails the rollback
instead of moving the wrong version.

The response's id is the pipeline run or the release-agent command carrying the
rollback out, and rollback_type says which, so the output points at the right
place to follow it.
@gcirclest
gcirclest merged commit 97d7a6b into main Aug 17, 2026
7 checks passed
@gcirclest
gcirclest deleted the rollback-comm branch August 17, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants