Skip to content

Exit non-zero when rolling back to a version with no container - #1984

Open
SeanLF wants to merge 1 commit into
basecamp:mainfrom
SeanLF:rollback-unavailable-version-exits-nonzero
Open

SeanLF wants to merge 1 commit into
basecamp:mainfrom
SeanLF:rollback-unavailable-version-exits-nonzero

Conversation

@SeanLF

@SeanLF SeanLF commented Nov 7, 2026

Copy link
Copy Markdown

kamal rollback VERSION printed "The app version 'VERSION' is not available as a container" when no host had that version, then exited 0. Scripts and CI saw a successful rollback while the old version kept running.

It now raises with the same message, so bin/kamal prints the error and exits 1. with_lock releases the deploy lock on the way out and neither hook runs. The rolled_back flag is gone: the post-deploy hook is only reached after a boot now.

Related to #1658, where kamal rollback --help lands in this same branch.

Copilot AI balanced review requested due to automatic review settings November 7, 2026 16:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

No active review issues are reported for the change to fail explicitly when a requested rollback version is unavailable.

No open issues 🎉

What changed in this PR

This PR makes rollback to an unavailable container version fail with a non-zero exit status, so scripts and CI no longer report success when no rollback occurred.

Changes:

  • Raise an error instead of printing a warning when the requested version is unavailable.
  • Remove the rollback flag; successful boot now leads directly to the post-deploy hook.
  • Update the failure test to assert the exception, lock release, and skipped hooks.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
test/​cli/​main_test.rb Assert unavailable-version errors, lock release, and no hook execution.
lib/​kamal/​cli/​main.rb Raise on unavailable rollback versions and simplify post-deploy hook execution.

Review effort: Balanced

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