]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
update storage-extract: use branchname to determine correct distribution
authorMathias Klette <mathias.klette@profitbricks.com>
Tue, 23 Apr 2013 09:45:10 +0000 (11:45 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Tue, 23 Apr 2013 16:11:30 +0000 (18:11 +0200)
extract_storage_kernel+modules.sh

index a2e51642ee5028c5ca910d25f7e069112fb0a247..43bcaa33ba8cf3684ee085a0642f35bfca84b327 100755 (executable)
@@ -29,24 +29,33 @@ function get_last_target_build_no() {
        echo $retval
 }
 
-if [ "$DISTRIBUTION" = "production-proposed-updates" ] ; then
+# overwrite PB_SUITE with branch name
+export PB_SUITE=$(echo $GIT_BRANCH_NAME | tr '/' '-' | sed -e "s/^\(feature\|bugfix\|poc\)-/dev-\1-/g")
+
+case $DISTRIBUTION in
+  production-proposed-updates)
        export TARGET_NAME=master
-elif [ "$DISTRIBUTION" = "pre-staging" ] ; then
+        ;;
+  pre-staging)
        export TARGET_NAME=develop
-elif [[ "$DISTRIBUTION" = dev-feature* ]] ; then
-       export TARGET_NAME=$DISTRIBUTION
+        ;;
+  experimental)
+       export TARGET_NAME=$PB_SUITE
        LAST_DEVELOP_BUILD_NO=$(get_last_target_build_no develop)
        BUILD_NUMBER="$LAST_DEVELOP_BUILD_NO.$(printf %03d $BUILD_NUMBER)"
        FEATURE_APTCMD="
        echo \"deb http://alexandria.pb.local/dev-repository $DISTRIBUTION main contrib non-free\" \
        > /etc/apt/sources.list.d/profitbricks-linux-image-storage-$DISTRIBUTION.list
        "
-else
-       echo "DISTRIBUTION must be 'production-proposed-updates', 'pre-staging', or 'dev-feature*'."
+        ;;
+  *)
+       echo "DISTRIBUTION must be 'production-proposed-updates', 'pre-staging', or 'experimental'."
        echo "exiting."
        figlet "FAIL"
        exit 1
-fi
+        ;;
+esac
+
 export TARGET_DIR=$TARGET_BASE/$TARGET_NAME/$BUILD_NUMBER
 export JOB_HOME=$JENKINS_HOME/jobs/$JOB_NAME/builds