Merge pull request #396 from igor-alexandrov/track-uncommitted-changes

Log uncommitted changes during deploy
This commit is contained in:
Donal McBreen
2023-07-25 14:35:44 +01:00
committed by GitHub
5 changed files with 24 additions and 4 deletions

View File

@@ -17,9 +17,15 @@ class Mrsk::Cli::Build < Mrsk::Cli::Base
verify_local_dependencies
run_hook "pre-build"
if (uncommitted_changes = Mrsk::Utils.uncommitted_changes).present?
say "The following paths have uncommitted changes:\n #{uncommitted_changes}", :yellow
end
run_locally do
begin
MRSK.with_verbosity(:debug) { execute *MRSK.builder.push }
MRSK.with_verbosity(:debug) do
execute *MRSK.builder.push
end
rescue SSHKit::Command::Failed => e
if e.message =~ /(no builder)|(no such file or directory)/
error "Missing compatible builder, so creating a new one first"

View File

@@ -253,7 +253,7 @@ class Mrsk::Configuration
def git_version
@git_version ||=
if system("git rev-parse")
uncommitted_suffix = `git status --porcelain`.strip.present? ? "_uncommitted_#{SecureRandom.hex(8)}" : ""
uncommitted_suffix = Mrsk::Utils.uncommitted_changes.present? ? "_uncommitted_#{SecureRandom.hex(8)}" : ""
"#{`git rev-parse HEAD`.strip}#{uncommitted_suffix}"
else

View File

@@ -93,4 +93,8 @@ module Mrsk::Utils
end
end
end
def uncommitted_changes
`git status --porcelain`.strip
end
end