Per destination latest image tag

We tag the deployed image with the latest image tag when deploying. But
if we are deploying multiple destinations to the same host they'll
conflict with each other.
This commit is contained in:
Donal McBreen
2024-03-27 09:43:21 +00:00
parent 786454f2ee
commit c884f2316d
2 changed files with 11 additions and 1 deletions

View File

@@ -128,7 +128,7 @@ class Kamal::Configuration
end
def latest_image
"#{repository}:latest"
"#{repository}:#{[ "latest", *destination ].join("-")}"
end
def service_with_version

View File

@@ -130,6 +130,16 @@ class ConfigurationTest < ActiveSupport::TestCase
assert_equal "ghcr.io/dhh/app:missing", config.absolute_image
end
test "latest image" do
assert_equal "dhh/app:latest", @config.latest_image
end
test "latest image with destination" do
dest_config_file = Pathname.new(File.expand_path("fixtures/deploy_for_dest.yml", __dir__))
config = Kamal::Configuration.create_from config_file: dest_config_file, destination: "world"
assert_equal "registry.digitalocean.com/dhh/app:latest-world", config.latest_image
end
test "service with version" do
assert_equal "app-missing", @config.service_with_version
end