Make detecting version more reliable

The docker bash scripts try to get the version from sbt, without
calling sbt but reading the files. This was relying on a specific
position. It is now a bit more robust.
This commit is contained in:
Eike Kettner 2021-04-12 00:42:48 +02:00
parent cb522ee6eb
commit df543a3e92
3 changed files with 4 additions and 12 deletions

View File

@ -5,12 +5,8 @@ if [ $# -eq 1 ]; then
REPO=$1 REPO=$1
fi fi
SBT_VERSION=$(grep sbt.version ../project/build.properties) SBT_VERSION=$(grep sbt.version ../project/build.properties|cut -d'=' -f2|xargs)
SBT_VERSION=${SBT_VERSION:12:99} VERSION=$(cat ../version.sbt | cut -d'=' -f2 | tr -d '"'|xargs)
TMP_VERSION=$(cat ../version.sbt)
TMP_VERSION=${TMP_VERSION:25:99}
VERSION=${TMP_VERSION%\"}
if [[ $VERSION == *"SNAPSHOT" ]]; then if [[ $VERSION == *"SNAPSHOT" ]]; then
VERSION=SNAPSHOT VERSION=SNAPSHOT

View File

@ -5,9 +5,7 @@ if [ $# -eq 1 ]; then
REPO=$1 REPO=$1
fi fi
TMP_VERSION=$(cat ../version.sbt) VERSION=$(cat ../version.sbt | cut -d'=' -f2 | tr -d '"'|xargs)
TMP_VERSION=${TMP_VERSION:25:99}
VERSION=${TMP_VERSION%\"}
if [[ $VERSION == *"SNAPSHOT" ]]; then if [[ $VERSION == *"SNAPSHOT" ]]; then
VERSION=SNAPSHOT VERSION=SNAPSHOT

View File

@ -15,9 +15,7 @@ echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# verify that version.sbt and tag match for non-snapshot (ENV variable DOCKER_VERIFY_TAG must be set to 1) # verify that version.sbt and tag match for non-snapshot (ENV variable DOCKER_VERIFY_TAG must be set to 1)
if [ $DOCKER_VERIFY_TAG -eq 1 ] && [[ "$DOCKER_TAG" != *"-SNAPSHOT" ]]; then if [ $DOCKER_VERIFY_TAG -eq 1 ] && [[ "$DOCKER_TAG" != *"-SNAPSHOT" ]]; then
echo validating version number... echo validating version number...
TMP_VERSION=$(cat ../version.sbt) VERSION=$(cat ../version.sbt | cut -d'=' -f2 | tr -d '"'|xargs)
TMP_VERSION=${TMP_VERSION:25:99}
VERSION=${TMP_VERSION%\"}
if [ "$DOCKER_TAG" != "base-v$VERSION" ]; then if [ "$DOCKER_TAG" != "base-v$VERSION" ]; then
echo "version number mismatch (Docker/Tag: $DOCKER_TAG, Project: $VERSION), aborting!" echo "version number mismatch (Docker/Tag: $DOCKER_TAG, Project: $VERSION), aborting!"
exit 1 exit 1