From 592d2d52948129145a8c4bbd10354823251f3ccb Mon Sep 17 00:00:00 2001 From: Robert Cannon Date: Fri, 21 Feb 2020 11:40:00 -0500 Subject: [PATCH] Added a fallback for when no tag is present --- git-version.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git-version.sh b/git-version.sh index 2373738..ba4a693 100644 --- a/git-version.sh +++ b/git-version.sh @@ -21,7 +21,10 @@ BUILD_GIT_TAG_DISTANCE=`echo ${BUILD_GIT_TAG_LONG} | awk -F '-' '{print $2}'` REGEX_VERSION='^(.*\/)?[0-9]+\.[0-9]+(\.[0-9]+)?$' -if [ "$BUILD_GIT_TAG_LONG" = "$BUILD_GIT_TAG" ]; then +if [ "$BUILD_GIT_TAG_LONG" = "" ]; then + # Without a tag, we can't get the distance from describe so making it up here with time and hash + export BUILD_VERSION=0.0.0-${BUILD_GIT_BRANCH_CLEAN}.t${BUILD_GIT_COMMIT_EPOCH}.g${BUILD_GIT_COMMIT_SHORT} +elif [ "$BUILD_GIT_TAG_LONG" = "$BUILD_GIT_TAG" ]; then export BUILD_VERSION=${BUILD_GIT_TAG} else if [ -z "$BUILD_GIT_TAG_DISTANCE" ]; then