From bb51684c3e7c9b6ac8072e6c4de3ee510ee84a1c Mon Sep 17 00:00:00 2001 From: kmova Date: Thu, 7 May 2020 14:31:59 +0000 Subject: [PATCH] refactor(build): trim leading v from image tag Using the github tag, docker image tags are created. As we move the github tags to semver format, the image tags will end up having a leading `v` in the tag. To keep the image tag names consistent with past releases, the leading `v` will be trimmed from the travis tag and the rest of the string will be used for image tag. Examples: 1.10.0 maps to 1.10.0 v1.10.0 maps to 1.10.0 v1.10.0-custom-RC1 maps to 1.10.0-custom-RC1 Signed-off-by: kmova --- openebs/buildscripts/push | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openebs/buildscripts/push b/openebs/buildscripts/push index f5cd2badf1b..16544ed842d 100755 --- a/openebs/buildscripts/push +++ b/openebs/buildscripts/push @@ -55,9 +55,18 @@ echo "Set the build/unique image tag as: ${BUILD_TAG}" function TagAndPushImage() { REPO="$1" - TAG="$2" + + # Trim the `v` from the TAG if it exists + # Example: v1.10.0 maps to 1.10.0 + # Example: 1.10.0 maps to 1.10.0 + # Example: v1.10.0-custom maps to 1.10.0-custom + TAG="${2#v}" - IMAGE_URI="${REPO}:${TAG}"; + #Add an option to specify a custom TAG_SUFFIX + #via environment variable. Default is no tag. + #Example suffix could be "-debug" of "-dev" + IMAGE_URI="${REPO}:${TAG}${TAG_SUFFIX}"; + sudo docker tag ${IMAGEID} ${IMAGE_URI}; echo " push ${IMAGE_URI}"; sudo docker push ${IMAGE_URI};