Compare commits

...

1 Commits

Author SHA1 Message Date
Matthew Kent
5b694a0814 Support passing a short-sha version for rollback when using git.
Only for emergencies.
2023-11-21 15:45:51 -08:00
2 changed files with 11 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
mutating do
invoke_options = deploy_options
KAMAL.config.version = version
KAMAL.config.version = Kamal::Git.used? ? Kamal::Git.resolve_revision(version) : version
old_version = nil
if container_available?(version)

View File

@@ -13,6 +13,16 @@ module Kamal::Git
`git rev-parse HEAD`.strip
end
# Attempt to convert a short -> long git sha, or return the original
def resolve_revision(revision)
resolved_rev = `git rev-parse -q --verify #{revision}`.strip
if resolved_rev.empty?
revision
else
resolved_rev
end
end
def uncommitted_changes
`git status --porcelain`.strip
end