Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional locking across the full deploy lifecycle, including post-deploy.
Changes:
- Adds and documents
post_deploy_lock. - Applies it to deploy, redeploy, and rollback.
- Tests configuration and deploy lock behavior.
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.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
lib/kamal/cli/main.rb |
Extends lock scope for deployment commands. |
lib/kamal/configuration.rb |
Exposes the configuration predicate. |
lib/kamal/configuration/docs/configuration.yml |
Documents the setting. |
test/cli/main_test.rb |
Tests deploy lock lifecycle. |
test/configuration_test.rb |
Tests default and enabled values. |
test/configuration/validation_test.rb |
Validates boolean input. |
test/fixtures/deploy_with_post_deploy_lock.yml |
Provides enabled test configuration. |
Suppressed comments (1)
lib/kamal/cli/main.rb:90
- The opt-in lock behavior for
rollbackis not covered by the new tests; rollback has distinct conditional hook flow and nested locking. Add a successful rollback case withpost_deploy_lock: truethat verifies the outer lock remains held throughpost-deployand is then released.
modify(lock: KAMAL.config.post_deploy_lock?) do
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deploy,redeploy, androllbackcurrently release the automatic remote lock before runningpost-deploy. That lets a waiting deployment begin mutating the same service while a stateful post-deploy hook (for example, migrations or cache warming) is still running.This adds an opt-in, backward-compatible configuration setting:
When enabled, the existing remote deploy lock covers the entire command, from before build/pull through completion of
post-deploy. The existing nested lock remains re-entrant, hooks inheritKAMAL_LOCK=true, and failures still release the lock. The default remainsfalse, so existing deployments are unchanged. (setupalready holds its outer lock through the nested deploy and remains unchanged.)Tests cover configuration/validation, acquisition and release order, lock visibility in
post-deploy, and release after hook failure.Validation:
./bin/testexcluding Docker integration: 841 runs, 2,745 assertions, 0 failures/errorsbundle exec rubocop: 178 files, no offenseskamalexecutable; all resulting integration errors occurred before test behavior.