diff --git a/lib/kamal/cli/build.rb b/lib/kamal/cli/build.rb index 9ce1f4a62..c655c6aeb 100644 --- a/lib/kamal/cli/build.rb +++ b/lib/kamal/cli/build.rb @@ -140,7 +140,7 @@ def mirror_hosts mirror_hosts = Concurrent::Hash.new on(KAMAL.hosts) do |host| first_mirror = capture_with_info(*KAMAL.builder.first_mirror).strip.presence - mirror_hosts[first_mirror] ||= host if first_mirror + mirror_hosts[first_mirror] ||= host.to_s if first_mirror rescue SSHKit::Command::Failed => e raise unless e.message =~ /error calling index: reflect: slice index out of range/ end diff --git a/test/cli/build_test.rb b/test/cli/build_test.rb index 4035ea511..18ff254b4 100644 --- a/test/cli/build_test.rb +++ b/test/cli/build_test.rb @@ -185,7 +185,7 @@ class CliBuildTest < CliTestCase run_command("pull").tap do |output| assert_match /Pulling image on 1\.1\.1\.\d to seed the mirror\.\.\./, output assert_match "Pulling image on remaining hosts...", output - assert_match /docker pull dhh\/app:999/, output + assert_equal 4, output.scan(/docker pull dhh\/app:999/).size, output assert_match "docker inspect -f '{{ .Config.Labels.service }}' dhh/app:999 | grep -x app || (echo \"Image dhh/app:999 is missing the 'service' label\" && exit 1)", output end end @@ -199,7 +199,7 @@ class CliBuildTest < CliTestCase run_command("pull").tap do |output| assert_match /Pulling image on 1\.1\.1\.\d, 1\.1\.1\.\d to seed the mirrors\.\.\./, output assert_match "Pulling image on remaining hosts...", output - assert_match /docker pull dhh\/app:999/, output + assert_equal 4, output.scan(/docker pull dhh\/app:999/).size, output assert_match "docker inspect -f '{{ .Config.Labels.service }}' dhh/app:999 | grep -x app || (echo \"Image dhh/app:999 is missing the 'service' label\" && exit 1)", output end end