Compare commits

..

5 Commits

Author SHA1 Message Date
Donal McBreen d141c82efa Bump version for 1.9.3 2025-06-25 08:29:11 +01:00
Donal McBreen cdb6c014ac Update Gemfile.lock 2025-06-25 08:04:44 +01:00
Donal McBreen 7ded6d3aef Use registry:3 image for the integration tests
v3 was recently released which broke the integration tests. Update them
to use the correct config file.

Set the major version to prevent this from happening when v4 is
released.
2025-06-25 08:04:44 +01:00
Donal McBreen 2ea60bea5e Merge pull request #1594 from basecamp/1-9-dotenv-precedence
Deploy env is authoritative (1-9-stable)
2025-06-25 07:55:12 +01:00
Jeremy Daer 3948a95e7a Fix local env vars overriding production env 2025-06-24 11:39:32 -07:00
6 changed files with 42 additions and 9 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
kamal (1.9.2) kamal (1.9.3)
activesupport (>= 7.0) activesupport (>= 7.0)
base64 (~> 0.2) base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0) bcrypt_pbkdf (~> 1.0)
@@ -78,11 +78,11 @@ GEM
net-sftp (4.0.0) net-sftp (4.0.0)
net-ssh (>= 5.0.0, < 8.0.0) net-ssh (>= 5.0.0, < 8.0.0)
net-ssh (7.2.1) net-ssh (7.2.1)
nokogiri (1.16.0-arm64-darwin) nokogiri (1.18.8-arm64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.16.0-x86_64-darwin) nokogiri (1.18.8-x86_64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.16.0-x86_64-linux) nokogiri (1.18.8-x86_64-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
parallel (1.24.0) parallel (1.24.0)
parser (3.3.0.5) parser (3.3.0.5)
+2 -2
View File
@@ -37,9 +37,9 @@ module Kamal::Cli
def load_env def load_env
if destination = options[:destination] if destination = options[:destination]
Dotenv.load(".env.#{destination}", ".env") Dotenv.overload(".env", ".env.#{destination}")
else else
Dotenv.load(".env") Dotenv.overload(".env")
end end
end end
+1 -1
View File
@@ -1,3 +1,3 @@
module Kamal module Kamal
VERSION = "1.9.2" VERSION = "1.9.3"
end end
+33
View File
@@ -490,6 +490,39 @@ class CliMainTest < CliTestCase
end end
end end
test "env files overwrite shell environment variables" do
ENV["TEST_VAR"] = "shell_value"
ENV["AWS_ACCESS_KEY_ID"] = "local_dev_key"
with_test_dotenv(".env": "TEST_VAR=dotenv_value\nAWS_ACCESS_KEY_ID=production_key") do
# Create a simple CLI command instance to trigger load_env
Kamal::Cli::Main.new.send(:load_env)
assert_equal "dotenv_value", ENV["TEST_VAR"]
assert_equal "production_key", ENV["AWS_ACCESS_KEY_ID"]
end
ensure
ENV.delete("TEST_VAR")
ENV.delete("AWS_ACCESS_KEY_ID")
end
test "destination env files overwrite base env files" do
ENV["TEST_VAR"] = "shell_value"
with_test_dotenv(".env": "TEST_VAR=base_value\nBASE_ONLY=base", ".env.world": "TEST_VAR=world_value\nWORLD_ONLY=world") do
# Create CLI command with destination to trigger load_env
Kamal::Cli::Main.new([], { destination: "world" }).send(:load_env)
assert_equal "world_value", ENV["TEST_VAR"]
assert_equal "base", ENV["BASE_ONLY"]
assert_equal "world", ENV["WORLD_ONLY"]
end
ensure
ENV.delete("TEST_VAR")
ENV.delete("BASE_ONLY")
ENV.delete("WORLD_ONLY")
end
test "remove with confirmation" do test "remove with confirmation" do
run_command("remove", "-y", config_file: "deploy_with_accessories").tap do |output| run_command("remove", "-y", config_file: "deploy_with_accessories").tap do |output|
assert_match /docker container stop traefik/, output assert_match /docker container stop traefik/, output
+1 -1
View File
@@ -1,4 +1,4 @@
FROM registry FROM registry:3
COPY boot.sh . COPY boot.sh .
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
exec /entrypoint.sh /etc/docker/registry/config.yml exec /entrypoint.sh /etc/distribution/config.yml