Include error message on failure
This commit is contained in:
@@ -158,8 +158,8 @@ module Kamal::Cli
|
|||||||
say "Running the #{hook} hook...", :magenta
|
say "Running the #{hook} hook...", :magenta
|
||||||
run_locally do
|
run_locally do
|
||||||
execute *KAMAL.hook.run(hook, **details, **extra_details)
|
execute *KAMAL.hook.run(hook, **details, **extra_details)
|
||||||
rescue SSHKit::Command::Failed
|
rescue SSHKit::Command::Failed => e
|
||||||
raise HookError.new("Hook `#{hook}` failed")
|
raise HookError.new("Hook `#{hook}` failed:\n#{e.message}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class CliBuildTest < CliTestCase
|
|||||||
test "push pre-build hook failure" do
|
test "push pre-build hook failure" do
|
||||||
fail_hook("pre-build")
|
fail_hook("pre-build")
|
||||||
|
|
||||||
assert_raises(Kamal::Cli::HookError) { run_command("push") }
|
error = assert_raises(Kamal::Cli::HookError) { run_command("push") }
|
||||||
|
assert_equal "Hook `pre-build` failed:\nfailed", error.message
|
||||||
|
|
||||||
assert @executions.none? { |args| args[0..2] == [ :docker, :buildx, :build ] }
|
assert @executions.none? { |args| args[0..2] == [ :docker, :buildx, :build ] }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user