From 1f2eef6e665f530091d0bb397d9170c60334c18f Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 24 Jul 2013 18:00:52 +0200 Subject: [PATCH] rename script and add a pre-build script, to merge feature branches into integration --- ...s.sh => maven_post_build_debian_wrapper.sh | 6 ++--- maven_pre_build_debian_wrapper.sh | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) rename debian_wrap_maven_results.sh => maven_post_build_debian_wrapper.sh (96%) create mode 100755 maven_pre_build_debian_wrapper.sh diff --git a/debian_wrap_maven_results.sh b/maven_post_build_debian_wrapper.sh similarity index 96% rename from debian_wrap_maven_results.sh rename to maven_post_build_debian_wrapper.sh index a5743ef..20d9745 100755 --- a/debian_wrap_maven_results.sh +++ b/maven_post_build_debian_wrapper.sh @@ -46,14 +46,14 @@ function validateInput DISTRIBUTION="dev-integration" else # set proper DISTRIBUTION for feature branches - DISTRIBUTION= $(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-') + DISTRIBUTION=$(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-') fi - APPEND_TO_VERSION = "experimental" + APPEND_TO_VERSION="experimental" elif ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; then echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS" exit 1 if [ "$DISTRIBUTION" = "unstable" ] || [ "$DISTRIBUTION" = "pre-staging" ] ; then - APPEND_TO_VERSION = "develop" + APPEND_TO_VERSION="develop" fi fi diff --git a/maven_pre_build_debian_wrapper.sh b/maven_pre_build_debian_wrapper.sh new file mode 100755 index 0000000..b8cf170 --- /dev/null +++ b/maven_pre_build_debian_wrapper.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +function containsElement () { + local e + for e in "${@:2}"; do [[ "$e" = "$1" ]] && return 0; done + return 1 +} + +set -e + +if [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] ; then + if containsElement "merge" "${BUILD_TRIGGERS[@]}" ; then + echo "Switching to integration branch..." + git checkout integration + echo "Trying to fast-forward merge $GIT_BRANCH_NAME..." + git merge --no-ff $GIT_BRANCH_NAME + fi +elif [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ] ; then + VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[") + TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',') + git tag $TAG -m "Testing whether there is already a tag $TAG..." + git tag -d $TAG +fi -- 2.39.5