Skip to content

Commit

Permalink
Merge pull request #498 from basecamp/app-exec-env-file
Browse files Browse the repository at this point in the history
App exec with env file
  • Loading branch information
djmb authored Oct 30, 2023
2 parents aa23f26 + 645f5ab commit 3704819
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/kamal/cli/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ def exec(cmd)
using_version(version_or_latest) do |version|
say "Launching command with version #{version} from new container...", :magenta
on(KAMAL.hosts) do |host|
execute *KAMAL.auditor.record("Executed cmd '#{cmd}' on app version #{version}"), verbosity: :debug
puts_by_host host, capture_with_info(*KAMAL.app.execute_in_new_container(cmd))
roles = KAMAL.roles_on(host)

roles.each do |role|
execute *KAMAL.auditor.record("Executed cmd '#{cmd}' on app version #{version}"), verbosity: :debug
puts_by_host host, capture_with_info(*KAMAL.app(role: role).execute_in_new_container(cmd))
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/cli/app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class CliAppTest < CliTestCase

test "exec" do
run_command("exec", "ruby -v").tap do |output|
assert_match "docker run --rm dhh/app:latest ruby -v", output
assert_match "docker run --rm --env-file .kamal/env/roles/app-web.env dhh/app:latest ruby -v", output
end
end

Expand Down

0 comments on commit 3704819

Please sign in to comment.