diff --git a/lib/kamal/cli/base.rb b/lib/kamal/cli/base.rb index 39b546f1..4d3c19eb 100644 --- a/lib/kamal/cli/base.rb +++ b/lib/kamal/cli/base.rb @@ -157,7 +157,7 @@ module Kamal::Cli say "Running the #{hook} hook...", :magenta run_locally do - KAMAL.with_verbosity(:debug) { execute *KAMAL.hook.run(hook, **details, **extra_details) } + execute *KAMAL.hook.run(hook, **details, **extra_details) rescue SSHKit::Command::Failed raise HookError.new("Hook `#{hook}` failed") end diff --git a/test/cli/build_test.rb b/test/cli/build_test.rb index 186c1e9e..9929b78b 100644 --- a/test/cli/build_test.rb +++ b/test/cli/build_test.rb @@ -12,7 +12,7 @@ class CliBuildTest < CliTestCase Kamal::Commands::Hook.any_instance.stubs(:hook_exists?).returns(true) hook_variables = { version: 999, service_version: "app@999", hosts: "1.1.1.1,1.1.1.2,1.1.1.3,1.1.1.4", command: "build", subcommand: "push" } - run_command("push").tap do |output| + run_command("push", "--verbose").tap do |output| assert_hook_ran "pre-build", output, **hook_variables assert_match /docker --version && docker buildx version/, output assert_match /git archive -tar HEAD | docker buildx build --push --platform linux\/amd64,linux\/arm64 --builder kamal-app-multiarch -t dhh\/app:999 -t dhh\/app:latest --label service="app" --file Dockerfile - as .*@localhost/, output diff --git a/test/cli/main_test.rb b/test/cli/main_test.rb index 6111ade8..094a8e56 100644 --- a/test/cli/main_test.rb +++ b/test/cli/main_test.rb @@ -46,7 +46,7 @@ class CliMainTest < CliTestCase end test "deploy" do - invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999", "skip_hooks" => false } + invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999", "skip_hooks" => false, "verbose" => true } Kamal::Cli::Main.any_instance.expects(:invoke).with("kamal:cli:registry:login", [], invoke_options) Kamal::Cli::Main.any_instance.expects(:invoke).with("kamal:cli:build:deliver", [], invoke_options) @@ -59,7 +59,7 @@ class CliMainTest < CliTestCase Kamal::Commands::Hook.any_instance.stubs(:hook_exists?).returns(true) hook_variables = { version: 999, service_version: "app@999", hosts: "1.1.1.1,1.1.1.2", command: "deploy" } - run_command("deploy").tap do |output| + run_command("deploy", "--verbose").tap do |output| assert_hook_ran "pre-connect", output, **hook_variables assert_match /Log into image registry/, output assert_match /Build and push app image/, output @@ -194,7 +194,7 @@ class CliMainTest < CliTestCase end test "redeploy" do - invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999", "skip_hooks" => false } + invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999", "skip_hooks" => false, "verbose" => true } Kamal::Cli::Main.any_instance.expects(:invoke).with("kamal:cli:build:deliver", [], invoke_options) Kamal::Cli::Main.any_instance.expects(:invoke).with("kamal:cli:healthcheck:perform", [], invoke_options) @@ -205,7 +205,7 @@ class CliMainTest < CliTestCase hook_variables = { version: 999, service_version: "app@999", hosts: "1.1.1.1,1.1.1.2", command: "redeploy" } - run_command("redeploy").tap do |output| + run_command("redeploy", "--verbose").tap do |output| assert_hook_ran "pre-connect", output, **hook_variables assert_match /Build and push app image/, output assert_hook_ran "pre-deploy", output, **hook_variables @@ -268,7 +268,7 @@ class CliMainTest < CliTestCase Kamal::Commands::Hook.any_instance.stubs(:hook_exists?).returns(true) hook_variables = { version: 123, service_version: "app@123", hosts: "1.1.1.1,1.1.1.2,1.1.1.3,1.1.1.4", command: "rollback" } - run_command("rollback", "123", config_file: "deploy_with_accessories").tap do |output| + run_command("rollback", "--verbose", "123", config_file: "deploy_with_accessories").tap do |output| assert_hook_ran "pre-deploy", output, **hook_variables assert_match "docker tag dhh/app:123 dhh/app:latest", output assert_match "docker run --detach --restart unless-stopped --name app-web-123", output diff --git a/test/integration/traefik_test.rb b/test/integration/traefik_test.rb index dcbdbfcb..d2aa2a97 100644 --- a/test/integration/traefik_test.rb +++ b/test/integration/traefik_test.rb @@ -7,13 +7,13 @@ class TraefikTest < IntegrationTest kamal :traefik, :boot assert_traefik_running - output = kamal :traefik, :reboot, "-y", capture: true + output = kamal :traefik, :reboot, "-y", "--verbose", capture: true assert_traefik_running assert_hooks_ran "pre-traefik-reboot", "post-traefik-reboot" assert_match /Rebooting Traefik on vm1,vm2.../, output assert_match /Rebooted Traefik on vm1,vm2/, output - output = kamal :traefik, :reboot, :"--rolling", "-y", capture: true + output = kamal :traefik, :reboot, "--rolling", "-y", "--verbose", capture: true assert_traefik_running assert_hooks_ran "pre-traefik-reboot", "post-traefik-reboot" assert_match /Rebooting Traefik on vm1.../, output