Added tests for accessory deploy and remove commands
This commit is contained in:
@@ -18,7 +18,11 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
||||
execute *accessory.ensure_env_directory
|
||||
upload! accessory.secrets_io, accessory.secrets_path, mode: "0600"
|
||||
execute *accessory.run
|
||||
execute *accessory.deploy if accessory.running_proxy?
|
||||
|
||||
if accessory.running_proxy?
|
||||
target = accessory.container_id_for(container_name: accessory.service_name, only_running: true)
|
||||
execute *accessory.deploy(target: target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -76,7 +80,10 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
||||
on(hosts) do
|
||||
execute *KAMAL.auditor.record("Started #{name} accessory"), verbosity: :debug
|
||||
execute *accessory.start
|
||||
execute *accessory.deploy if accessory.running_proxy?
|
||||
if accessory.running_proxy?
|
||||
target = container_id_for(container_name: service_name, only_running: true)
|
||||
execute *accessory.deploy(target: target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -89,7 +96,11 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
||||
on(hosts) do
|
||||
execute *KAMAL.auditor.record("Stopped #{name} accessory"), verbosity: :debug
|
||||
execute *accessory.stop, raise_on_non_zero_exit: false
|
||||
execute *accessory.remove if accessory.running_proxy?
|
||||
|
||||
if accessory.running_proxy?
|
||||
target = accessory.container_id_for(container_name: accessory.service_name, only_running: true)
|
||||
execute *accessory.remove(target: target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,14 +40,12 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
|
||||
docker :ps, *service_filter
|
||||
end
|
||||
|
||||
def deploy
|
||||
target = container_id_for(container_name: service_name, only_running: true)
|
||||
proxy_exec :deploy, service_name, *accessory_config.proxy.deploy_command_args(target: target) if target
|
||||
def deploy(target:)
|
||||
proxy_exec :deploy, service_name, *accessory_config.proxy.deploy_command_args(target: target)
|
||||
end
|
||||
|
||||
def remove
|
||||
target = container_id_for(container_name: service_name, only_running: true)
|
||||
proxy_exec :remove, service_name, *accessory_config.proxy.remove_command_args(target: target) if target
|
||||
def remove(target:)
|
||||
proxy_exec :remove, service_name, *accessory_config.proxy.remove_command_args(target: target)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user