Add service_version and add running hook message
This commit is contained in:
@@ -132,13 +132,12 @@ module Mrsk::Cli
|
||||
end
|
||||
|
||||
def run_hook(hook, **details)
|
||||
run_locally do
|
||||
if MRSK.hook.hook_exists?(hook)
|
||||
begin
|
||||
MRSK.with_verbosity(:debug) { execute(*MRSK.hook.run(hook, **details)) }
|
||||
rescue SSHKit::Command::Failed
|
||||
raise HookError.new("Hook `#{hook}` failed")
|
||||
end
|
||||
if MRSK.hook.hook_exists?(hook)
|
||||
say "Running the #{hook} hook...", :magenta
|
||||
run_locally do
|
||||
MRSK.with_verbosity(:debug) { execute *MRSK.hook.run(hook, **details) }
|
||||
rescue SSHKit::Command::Failed
|
||||
raise HookError.new("Hook `#{hook}` failed")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -238,8 +238,4 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
|
||||
def deploy_options
|
||||
{ "version" => MRSK.config.version }.merge(options.without("skip_push"))
|
||||
end
|
||||
|
||||
def service_version(version = MRSK.config.abbreviated_version)
|
||||
[ MRSK.config.service, version ].compact.join("@")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
|
||||
# Runs remotely
|
||||
def record(line, **details)
|
||||
append \
|
||||
[ :echo, audit_tags(**details).except(:version).to_s, line ],
|
||||
[ :echo, audit_tags(**details).except(:version, :service_version).to_s, line ],
|
||||
audit_log_file
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,12 @@ class Mrsk::Tags
|
||||
{ recorded_at: Time.now.utc.iso8601,
|
||||
performer: `whoami`.chomp,
|
||||
destination: config.destination,
|
||||
version: config.version }
|
||||
version: config.version,
|
||||
service_version: service_version(config) }
|
||||
end
|
||||
|
||||
def service_version(config)
|
||||
[ config.service, config.abbreviated_version ].compact.join("@")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -84,6 +84,13 @@ module Mrsk::Utils
|
||||
|
||||
# Abbreviate a git revhash for concise display
|
||||
def abbreviate_version(version)
|
||||
version[0...7] if version
|
||||
if version
|
||||
# Don't abbreviate <sha>_uncommitted_<etc>
|
||||
if version.include?("_")
|
||||
version
|
||||
else
|
||||
version[0...7]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user