[FIX] Fix tag creation if version contain colon '2:<version>'
User Story: https://mirantis.jira.com/browse/RILBCK-436
Change-Id: Ic929b50ac8921500cb0519e48d76e477074e9767
diff --git a/src/com/mirantis/mk/Debian.groovy b/src/com/mirantis/mk/Debian.groovy
index 7093d7e..9746ada 100644
--- a/src/com/mirantis/mk/Debian.groovy
+++ b/src/com/mirantis/mk/Debian.groovy
@@ -136,7 +136,7 @@
sudo -H -E -u jenkins git config --global user.name "${gitName}" &&
sudo -H -E -u jenkins git config --global user.email "${gitEmail}" &&
[[ "${snapshot}" == "false" ]] || (
- VERSION=`dpkg-parsechangelog --count 1 | grep Version: | sed "s,Version: ,,g"` &&
+ VERSION=`dpkg-parsechangelog --count 1 --show-field Version` &&
UPSTREAM_VERSION=`echo \$VERSION | cut -d "-" -f 1` &&
REVISION=`echo \$VERSION | cut -d "-" -f 2` &&
TIMESTAMP=`date +%Y%m%d%H%M` &&
@@ -144,10 +144,11 @@
UPSTREAM_BRANCH=`(grep upstream-branch debian/gbp.conf || echo master) | cut -d = -f 2 | tr -d " "` &&
UPSTREAM_REV=`git rev-parse --short origin/\$UPSTREAM_BRANCH` &&
NEW_UPSTREAM_VERSION="\$UPSTREAM_VERSION+\$TIMESTAMP.\$UPSTREAM_REV" &&
+ NEW_UPSTREAM_VERSION_TAG=`echo \$NEW_UPSTREAM_VERSION | sed 's/.*://'` &&
NEW_VERSION=\$NEW_UPSTREAM_VERSION-\$REVISION$revisionPostfix &&
- echo "Generating new upstream version \$NEW_UPSTREAM_VERSION" &&
- sudo -H -E -u jenkins git tag \$NEW_UPSTREAM_VERSION origin/\$UPSTREAM_BRANCH &&
- sudo -H -E -u jenkins git merge -X theirs \$NEW_UPSTREAM_VERSION
+ echo "Generating new upstream version \$NEW_UPSTREAM_VERSION_TAG" &&
+ sudo -H -E -u jenkins git tag \$NEW_UPSTREAM_VERSION_TAG origin/\$UPSTREAM_BRANCH &&
+ sudo -H -E -u jenkins git merge -X theirs \$NEW_UPSTREAM_VERSION_TAG
else
NEW_VERSION=\$VERSION+\$TIMESTAMP.`git rev-parse --short HEAD`$revisionPostfix
fi &&