Merge pull request #656 from DanielJackson-Oslo/informative-error-message-on-lock

Informative message on lock error
This commit is contained in:
Donal McBreen
2024-03-07 11:16:18 +00:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -123,8 +123,9 @@ module Kamal::Cli
yield yield
rescue SSHKit::Runner::ExecuteError => e rescue SSHKit::Runner::ExecuteError => e
if e.message =~ /cannot create directory/ if e.message =~ /cannot create directory/
say "Deploy lock already in place!", :red
on(KAMAL.primary_host) { puts capture_with_debug(*KAMAL.lock.status) } on(KAMAL.primary_host) { puts capture_with_debug(*KAMAL.lock.status) }
raise LockError, "Deploy lock found" raise LockError, "Deploy lock found. Run 'kamal lock help' for more information"
else else
raise e raise e
end end

View File

@@ -10,7 +10,7 @@ class LockTest < IntegrationTest
assert_match /Locked by: Deployer at .*\nVersion: #{latest_app_version}\nMessage: Integration Tests/m, status assert_match /Locked by: Deployer at .*\nVersion: #{latest_app_version}\nMessage: Integration Tests/m, status
error = kamal :deploy, capture: true, raise_on_error: false error = kamal :deploy, capture: true, raise_on_error: false
assert_match /Deploy lock found/m, error assert_match /Deploy lock found. Run 'kamal lock help' for more information/m, error
kamal :lock, :release kamal :lock, :release