From: Pascal Giannakakis Date: Mon, 23 Jun 2014 17:57:45 +0000 (+0200) Subject: - Re-adds tagging feature that was accidentally dropped X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=cacfae600e04d9b61f38e545a5a8ac96d4efecb0;p=profitbricks%2Fjenkins-build-scripts.git - Re-adds tagging feature that was accidentally dropped --- diff --git a/maven_post_build_debian_wrapper.sh b/maven_post_build_debian_wrapper.sh index 4d2dde8..c1e2244 100755 --- a/maven_post_build_debian_wrapper.sh +++ b/maven_post_build_debian_wrapper.sh @@ -7,16 +7,36 @@ # # this script is run after maven for maven build jobs +function validateSettings { + VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[" | grep -v "^D" ) + if [[ -z "${VERSION}" ]]; then + echo "ERROR: Cannot get version from maven using 'mvn -B -N help:evaluate -Dexpression=project.version'" + mvn -B -N help:evaluate -Dexpression=project.version + exit 1 + fi +} + ############# # MAIN ############# cd $WORKSPACE +validateSettings + export set -e # fail on error set -x # echo commands executed +# push back to git repo if build from master or hotfix/ +if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then + # ~ and : are not valid in git tags, replace them: + TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',') + git tag $TAG + git push origin $TAG + figlet "Tagged." +fi + # push back integration branch if we merged a feature branch if [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]]; then if [[ "$BUILD_TRIGGERS" = *"merge"* ]]; then