diff --git a/lib/kamal/cli/build.rb b/lib/kamal/cli/build.rb index 0347d18c8..a07dab144 100644 --- a/lib/kamal/cli/build.rb +++ b/lib/kamal/cli/build.rb @@ -5,7 +5,7 @@ class BuildError < StandardError; end desc "deliver", "Build app and push app image to registry then pull image on servers" def deliver - push + push unless pushed? pull end @@ -157,4 +157,10 @@ def pull_on_hosts(hosts) execute *KAMAL.builder.validate_image end end + + def pushed? + run_locally { execute *KAMAL.docker.manifest(KAMAL.builder.absolute_image) } + rescue SSHKit::Command::Failed + false + end end diff --git a/lib/kamal/commands/builder.rb b/lib/kamal/commands/builder.rb index cd2980fbf..4dba57ddd 100644 --- a/lib/kamal/commands/builder.rb +++ b/lib/kamal/commands/builder.rb @@ -2,7 +2,8 @@ class Kamal::Commands::Builder < Kamal::Commands::Base delegate :create, :remove, :push, :clean, :pull, :info, :inspect_builder, :validate_image, :first_mirror, to: :target - delegate :local?, :remote?, to: "config.builder" + delegate :absolute_image, :builder, to: :config + delegate :local?, :remote?, to: :builder include Clone diff --git a/lib/kamal/commands/docker.rb b/lib/kamal/commands/docker.rb index bc9345dfc..ed17906a5 100644 --- a/lib/kamal/commands/docker.rb +++ b/lib/kamal/commands/docker.rb @@ -14,6 +14,10 @@ def running? docker :version end + def manifest(tag) + docker :manifest, :inspect, tag + end + # Do we have superuser access to install Docker and start system services? def superuser? [ '[ "${EUID:-$(id -u)}" -eq 0 ] || command -v sudo >/dev/null || command -v su >/dev/null' ] diff --git a/test/integration/main_test.rb b/test/integration/main_test.rb index 5a4eb91c8..0dd86f4a6 100644 --- a/test/integration/main_test.rb +++ b/test/integration/main_test.rb @@ -2,7 +2,7 @@ class MainTest < IntegrationTest test "deploy, redeploy, rollback, details and audit" do - first_version = latest_app_version + first_version = update_app_rev assert_app_is_down @@ -38,7 +38,7 @@ class MainTest < IntegrationTest test "app with roles" do @app = "app_with_roles" - version = latest_app_version + version = update_app_rev assert_app_is_down