Skip to content

Commit

Permalink
Pull once from hosts that warm registry mirrors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Jul 18, 2024
1 parent 8a98949 commit 57d9ce1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/kamal/cli/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/cli/build_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 57d9ce1

Please sign in to comment.