Fix KAMAL_DESTINATION missing during alias ERB render - #1954
Open
vulragrag-star wants to merge 1 commit into
Open
vulragrag-star wants to merge 1 commit into
vulragrag-star wants to merge 1 commit into
Conversation
Alias resolution calls load_raw_config before create_from, so ERB that branches on ENV["KAMAL_DESTINATION"] saw nil on the first pass even when -d/--destination was on the command line. Set the env var in load_raw_config so both paths share the same behavior. Fixes basecamp#1953
Contributor
There was a problem hiding this comment.
🟢 Approved
The shared loading path now matches existing configuration behavior and has focused regression coverage.
Pull request overview
Fixes #1953 by exposing the selected destination while ERB renders during alias resolution.
Changes:
- Moves
KAMAL_DESTINATIONassignment into shared raw-config loading. - Adds regression coverage and destination-aware fixtures.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
File summaries
| File | Description |
|---|---|
lib/kamal/configuration.rb |
Sets the destination environment variable before raw ERB rendering. |
test/configuration_test.rb |
Tests destination availability during raw loading. |
test/fixtures/deploy_alias_needs_destination.yml |
Provides an alias configuration requiring the destination. |
test/fixtures/deploy_alias_needs_destination.staging.yml |
Provides the destination-specific overlay. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 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.
Alias commands resolve through
load_raw_configbeforecreate_from. Onlycreate_fromsetENV["KAMAL_DESTINATION"], so ERB that branches on that variable sawnilon the first render even when-d/--destinationwas on the command line.This moves the env assignment into
load_raw_configso alias resolution and normal config loading share the same behavior.Fixes #1953
Test plan
bundle exec ruby -Itest test/configuration_test.rb -n /destination/(5 runs, 0 failures)test/configuration_test.rb(59 runs, 0 failures)./bin/teston CI