Skip existing containers on accessory boot

When booting an accessory, check for the container first and skip boot
if it exists. This allows us to rerun `kamal setup` on hosts with
accessories without raising an error.

Fixes: https://github.com/basecamp/kamal/issues/488
This commit is contained in:
Donal McBreen
2025-04-18 10:49:19 +01:00
parent 399f1526af
commit 03cac7ae3d
4 changed files with 17 additions and 3 deletions

View File

@@ -17,6 +17,9 @@ class AccessoryTest < IntegrationTest
logs = kamal :accessory, :logs, :busybox, capture: true
assert_match /Starting busybox.../, logs
boot = kamal :accessory, :boot, :busybox, capture: true
assert_match /Skipping booting `busybox` on vm1, vm2, a container already exists/, boot
kamal :accessory, :remove, :busybox, "-y"
assert_accessory_not_running :busybox
end

View File

@@ -11,7 +11,7 @@ class IntegrationTest < ActiveSupport::TestCase
end
teardown do
if !passed? && ENV["DEBUG"]
if !passed? && ENV["DEBUG_CONTAINER_LOGS"]
[ :deployer, :vm1, :vm2, :shared, :load_balancer, :registry ].each do |container|
puts
puts "Logs for #{container}:"