From 7ac987b59d9590862a3b9fb0f47f3cc0ae4cdb4d Mon Sep 17 00:00:00 2001 From: Craig Bryant Date: Mon, 8 Feb 2016 11:55:46 -0700 Subject: [PATCH] Ensure the same branch is used for common build Only the master branch is used today, but be ready when there are additional branches Change-Id: I77c9265c3c23dfcf04bb77db01527cc0b12cccfb --- common/build_common.sh | 3 ++- run_maven.sh | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/common/build_common.sh b/common/build_common.sh index 865ac050..f3147411 100755 --- a/common/build_common.sh +++ b/common/build_common.sh @@ -4,6 +4,7 @@ ME=`whoami` echo "Running as user: $ME" MVN=$1 VERSION=$2 +BRANCH=$3 check_user() { ME=$1 @@ -22,7 +23,7 @@ fi # This should only be done on the stack forge system if [ "${BUILD_COMMON}" = "true" ]; then - git clone https://github.com/openstack/monasca-common + git clone -b ${BRANCH} https://git.openstack.org/openstack/monasca-common cd monasca-common ${MVN} clean ${MVN} install diff --git a/run_maven.sh b/run_maven.sh index b153475f..a7cf4afc 100755 --- a/run_maven.sh +++ b/run_maven.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -x +env # Download maven 3 if the system maven isn't maven 3 VERSION=`mvn -v | grep "Apache Maven 3"` if [ -z "${VERSION}" ]; then @@ -28,7 +30,13 @@ for ARG in $*; do done if [ $RUN_BUILD = "true" ]; then - ( cd common; ./build_common.sh ${MVN} ${COMMON_VERSION} ) + if [ ! -z "$ZUUL_BRANCH" ]; then + BRANCH=${ZUUL_BRANCH} + else + BRANCH=${ZUUL_REF} + fi + + ( cd common; ./build_common.sh ${MVN} ${COMMON_VERSION} ${BRANCH} ) RC=$? if [ $RC != 0 ]; then exit $RC @@ -36,7 +44,7 @@ if [ $RUN_BUILD = "true" ]; then fi # Invoke the maven 3 on the real pom.xml -( cd java; ${MVN} -DgitRevision=`git rev-list HEAD --max-count 1 --abbrev=0 --abbrev-commit` $* ) +( cd java; ${MVN} -DgitRevision=`git rev-list HEAD --max-count 1 --abbrev=0 --abbrev-commit` $* ) RC=$?