diff --git a/lib/kamal/git.rb b/lib/kamal/git.rb index c25b055c..a286f735 100644 --- a/lib/kamal/git.rb +++ b/lib/kamal/git.rb @@ -9,6 +9,10 @@ module Kamal::Git `git config user.name`.strip end + def email + `git config user.email`.strip + end + def revision `git rev-parse HEAD`.strip end diff --git a/lib/kamal/tags.rb b/lib/kamal/tags.rb index 95145f29..ba9088fb 100644 --- a/lib/kamal/tags.rb +++ b/lib/kamal/tags.rb @@ -10,7 +10,7 @@ class Kamal::Tags def default_tags(config) { recorded_at: Time.now.utc.iso8601, - performer: `whoami`.chomp, + performer: Kamal::Git.email.presence || `whoami`.chomp, destination: config.destination, version: config.version, service_version: service_version(config), diff --git a/test/cli/cli_test_case.rb b/test/cli/cli_test_case.rb index a680824c..4ae7c1cb 100644 --- a/test/cli/cli_test_case.rb +++ b/test/cli/cli_test_case.rb @@ -42,7 +42,7 @@ class CliTestCase < ActiveSupport::TestCase end def assert_hook_ran(hook, output, version:, service_version:, hosts:, command:, subcommand: nil, runtime: false) - performer = `whoami`.strip + performer = Kamal::Git.email.presence || `whoami`.chomp service = service_version.split("@").first assert_match "Running the #{hook} hook...\n", output diff --git a/test/commands/auditor_test.rb b/test/commands/auditor_test.rb index 29b0025d..5b7a34c5 100644 --- a/test/commands/auditor_test.rb +++ b/test/commands/auditor_test.rb @@ -12,7 +12,7 @@ class CommandsAuditorTest < ActiveSupport::TestCase } @auditor = new_command - @performer = `whoami`.strip + @performer = Kamal::Git.email.presence || `whoami`.chomp @recorded_at = Time.now.utc.iso8601 end diff --git a/test/commands/hook_test.rb b/test/commands/hook_test.rb index 932c92f2..c0e6e98f 100644 --- a/test/commands/hook_test.rb +++ b/test/commands/hook_test.rb @@ -11,7 +11,7 @@ class CommandsHookTest < ActiveSupport::TestCase traefik: { "args" => { "accesslog.format" => "json", "metrics.prometheus.buckets" => "0.1,0.3,1.2,5.0" } } } - @performer = `whoami`.strip + @performer = Kamal::Git.email.presence || `whoami`.chomp @recorded_at = Time.now.utc.iso8601 end