From 58a51b079e7cc7d1344f3e08cc5b548148b5a6c7 Mon Sep 17 00:00:00 2001 From: Nick Hammond Date: Thu, 27 Jun 2024 10:52:55 -0600 Subject: [PATCH] Add KAMAL_SERVICE to custom hooks and exclude from auditor --- lib/kamal/commands/auditor.rb | 2 +- test/commands/hook_test.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/kamal/commands/auditor.rb b/lib/kamal/commands/auditor.rb index 3e1a71a7..f0c0850d 100644 --- a/lib/kamal/commands/auditor.rb +++ b/lib/kamal/commands/auditor.rb @@ -9,7 +9,7 @@ class Kamal::Commands::Auditor < Kamal::Commands::Base # Runs remotely def record(line, **details) append \ - [ :echo, audit_tags(**details).except(:version, :service_version).to_s, line ], + [ :echo, audit_tags(**details).except(:version, :service_version, :service).to_s, line ], audit_log_file end diff --git a/test/commands/hook_test.rb b/test/commands/hook_test.rb index 688c7156..932c92f2 100644 --- a/test/commands/hook_test.rb +++ b/test/commands/hook_test.rb @@ -22,7 +22,8 @@ class CommandsHookTest < ActiveSupport::TestCase "KAMAL_RECORDED_AT" => @recorded_at, "KAMAL_PERFORMER" => @performer, "KAMAL_VERSION" => "123", - "KAMAL_SERVICE_VERSION" => "app@123" } } + "KAMAL_SERVICE_VERSION" => "app@123", + "KAMAL_SERVICE" => "app" } } ], new_command.run("foo") end @@ -33,7 +34,8 @@ class CommandsHookTest < ActiveSupport::TestCase "KAMAL_RECORDED_AT" => @recorded_at, "KAMAL_PERFORMER" => @performer, "KAMAL_VERSION" => "123", - "KAMAL_SERVICE_VERSION" => "app@123" } } + "KAMAL_SERVICE_VERSION" => "app@123", + "KAMAL_SERVICE" => "app" } } ], new_command(hooks_path: "custom/hooks/path").run("foo") end