Don't hold lock on error

This commit is contained in:
Donal McBreen
2024-04-03 12:45:11 +01:00
parent d2a719998a
commit 64f5955444
4 changed files with 24 additions and 42 deletions

View File

@@ -91,12 +91,11 @@ module Kamal::Cli
begin
yield
rescue
if KAMAL.hold_lock_on_error?
error " \e[31mDeploy lock was not released\e[0m"
else
begin
release_lock
rescue => e
say "Error releasing the deploy lock: #{e.message}", :red
end
raise
end
@@ -141,16 +140,6 @@ module Kamal::Cli
end
end
def hold_lock_on_error
if KAMAL.hold_lock_on_error?
yield
else
KAMAL.hold_lock_on_error = true
yield
KAMAL.hold_lock_on_error = false
end
end
def run_hook(hook, **extra_details)
if !options[:skip_hooks] && KAMAL.hook.hook_exists?(hook)
details = { hosts: KAMAL.hosts.join(","), command: command, subcommand: subcommand }