Merge pull request #1520 from basecamp/inherit-lock

Inherit locks
This commit is contained in:
Donal McBreen
2025-04-22 09:31:35 +01:00
committed by GitHub
3 changed files with 43 additions and 4 deletions

View File

@@ -133,7 +133,13 @@ module Kamal::Cli
def run_hook(hook, **extra_details)
if !options[:skip_hooks] && KAMAL.hook.hook_exists?(hook)
details = { hosts: KAMAL.hosts.join(","), roles: KAMAL.specific_roles&.join(","), command: command, subcommand: subcommand }.compact
details = {
hosts: KAMAL.hosts.join(","),
roles: KAMAL.specific_roles&.join(","),
lock: KAMAL.holding_lock?.to_s,
command: command,
subcommand: subcommand
}.compact
say "Running the #{hook} hook...", :magenta
with_env KAMAL.hook.env(**details, **extra_details) do

View File

@@ -13,7 +13,7 @@ class Kamal::Commander
def reset
self.verbosity = :info
self.holding_lock = false
self.holding_lock = ENV["KAMAL_LOCK"] == "true"
self.connected = false
@specifics = @specific_roles = @specific_hosts = nil
@config = @config_kwargs = nil