Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Allow clean builds from tarballs (no git repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
stealthybox committed Jan 4, 2021
1 parent b042445 commit 51da87b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hack/ldflags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# Note: This file is heavily inspired by https://github.com/kubernetes/kubernetes/blob/master/hack/lib/version.sh

is_git_repo() {
# https://stackoverflow.com/a/2180367
[ -d .git ] && echo .git || git rev-parse --git-dir > /dev/null 2>&1
}

git_to_image_tag() {
echo "${1//+/-}"
}
Expand All @@ -12,7 +17,8 @@ get_version_vars() {
IGNITE_KERNEL_IMAGE_NAME="${DOCKER_USER}/ignite-kernel"

IGNITE_GIT_COMMIT=$(git rev-parse "HEAD^{commit}" 2>/dev/null)
if git_status=$(git status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then

if (! is_git_repo) || git_status=$(git status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then
IGNITE_GIT_TREE_STATE="clean"
else
IGNITE_GIT_TREE_STATE="dirty"
Expand Down

0 comments on commit 51da87b

Please sign in to comment.