Skip to content

Commit

Permalink
[docker] Fix build to work outside of Git WD
Browse files Browse the repository at this point in the history
The build script failed when being outside of a Git working directory.
This patch changes the VCS_REF to be the version info when it's not
built from a Git working directory.

Change-Id: I802157687384f3fd1b223d26041b3e8e1722b965
Reviewed-on: http://gerrit.cloudera.org:8080/12602
Reviewed-by: Grant Henke <[email protected]>
Tested-by: Attila Bukor <[email protected]>
  • Loading branch information
attilabukor committed Feb 27, 2019
1 parent dc77bb5 commit 1aae078
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docker/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ TAG_HASH=${TAG_HASH:=0}
DOCKER_CACHE_FROM=${DOCKER_CACHE_FROM:=""}

VERSION=$(cat "$ROOT/version.txt")
VCS_REF=$(git rev-parse --short HEAD)
VCS_REF=$(git rev-parse --short HEAD || echo "")

# Create the VERSION_TAG.
if [[ "$VERSION" == *-SNAPSHOT ]]; then
if [[ "$VCS_REF" == "" ]]; then
echo "ERROR: Snapshot builds need to be built in a Git working directory"
exit 1
fi

IS_RELEASE_VERSION=0
VERSION_TAG="$VCS_REF"
else
Expand Down Expand Up @@ -233,4 +238,4 @@ if [[ "$PUBLISH" == 1 ]]; then
for TAG in "${TAGS[@]}"; do
docker push "${TAG}"
done
fi
fi

0 comments on commit 1aae078

Please sign in to comment.