Skip to content

Commit 3c2163a

Browse files
authored
Merge pull request #1401 from basecamp/avoid-docker-check-with-skipping-local
Only check for docker when logging in locally
2 parents 45197e4 + fdf7e69 commit 3c2163a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/kamal/cli/registry.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Kamal::Cli::Registry < Kamal::Cli::Base
33
option :skip_local, aliases: "-L", type: :boolean, default: false, desc: "Skip local login"
44
option :skip_remote, aliases: "-R", type: :boolean, default: false, desc: "Skip remote login"
55
def login
6-
ensure_docker_installed
6+
ensure_docker_installed unless options[:skip_local]
77

88
run_locally { execute *KAMAL.registry.login } unless options[:skip_local]
99
on(KAMAL.hosts) { execute *KAMAL.registry.login } unless options[:skip_remote]

test/cli/registry_test.rb

+12
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ class CliRegistryTest < CliTestCase
5252
assert_raises(Kamal::Cli::DependencyError) { run_command("login") }
5353
end
5454

55+
test "allow remote login with no docker" do
56+
stub_setup
57+
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
58+
.with(:docker, "--version", "&&", :docker, :buildx, "version")
59+
.raises(SSHKit::Command::Failed.new("command not found"))
60+
61+
SSHKit::Backend::Abstract.any_instance.stubs(:execute)
62+
.with { |*args| args[0..1] == [ :docker, :login ] }
63+
64+
assert_nothing_raised { run_command("login", "--skip-local") }
65+
end
66+
5567

5668
private
5769
def run_command(*command)

0 commit comments

Comments
 (0)