From fca363d44c64cbdf5484f30c21d901de5ee8c368 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Fri, 28 Sep 2018 15:09:31 -0400 Subject: Apex: Fixes branch checking With the move to upstream artifacts post-fraser the checks to use upstream artifacts were relying on BRANCH == 'master'. This doesn't scale as we preserve fraser functionality but add more branches like gambia. Therefore inversing the logic to accomodate for new branches. Change-Id: Ice17f6afd33744f44d253d320a194c3f6d02d8bf Signed-off-by: Tim Rozet --- jjb/apex/apex-build.sh | 8 ++++---- jjb/apex/apex-deploy.sh | 9 ++------- jjb/apex/apex-download-artifact.sh | 4 ++-- jjb/apex/apex-iso-verify.sh | 4 ++-- jjb/apex/apex-upload-artifact.sh | 10 +++++----- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/jjb/apex/apex-build.sh b/jjb/apex/apex-build.sh index 09aa716be..a8ed1f8b7 100755 --- a/jjb/apex/apex-build.sh +++ b/jjb/apex/apex-build.sh @@ -12,7 +12,7 @@ echo if echo $ARTIFACT_VERSION | grep "dev" 1> /dev/null; then GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$') export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}" - if [ "$BRANCH" == 'master' ]; then + if [[ "$BRANCH" != 'stable/fraser' ]]; then # build rpm export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c $CACHE_DIRECTORY --rpms" else @@ -23,14 +23,14 @@ elif echo $BUILD_TAG | grep "csit" 1> /dev/null; then export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c $CACHE_DIRECTORY" elif [ "$ARTIFACT_VERSION" == "daily" ]; then export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d") - if [ "$BRANCH" == 'master' ]; then + if [[ "$BRANCH" != 'stable/fraser' ]]; then export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c $CACHE_DIRECTORY --rpms" else export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c $CACHE_DIRECTORY --iso" fi else export OPNFV_ARTIFACT_VERSION=${ARTIFACT_VERSION} - if [ "$BRANCH" == 'master' ]; then + if [[ "$BRANCH" != 'stable/fraser' ]]; then export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c $CACHE_DIRECTORY --rpms" else export BUILD_ARGS="-r $OPNFV_ARTIFACT_VERSION -c $CACHE_DIRECTORY --iso" @@ -59,7 +59,7 @@ echo "Cache Directory Contents:" echo "-------------------------" ls -al $CACHE_DIRECTORY -if [[ "$BUILD_ARGS" =~ '--iso' && "$BRANCH" != 'master' ]]; then +if [[ "$BUILD_ARGS" =~ '--iso' && "$BRANCH" == 'stable/fraser' ]]; then mkdir -p /tmp/apex-iso/ rm -f /tmp/apex-iso/*.iso cp -f $BUILD_DIRECTORY/../.build/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso /tmp/apex-iso/ diff --git a/jjb/apex/apex-deploy.sh b/jjb/apex/apex-deploy.sh index 441bf9059..1bc727d32 100755 --- a/jjb/apex/apex-deploy.sh +++ b/jjb/apex/apex-deploy.sh @@ -29,7 +29,7 @@ if [[ "$ARTIFACT_VERSION" =~ dev ]]; then # we want to use that built in mechanism to avoid re-downloading every job # so we use a dedicated folder to hold the upstream cache UPSTREAM_CACHE=$HOME/upstream_cache - if [ "$BRANCH" == 'master' ]; then + if [[ "$BRANCH" != 'stable/fraser' ]]; then mkdir -p ${UPSTREAM_CACHE} RESOURCES=$UPSTREAM_CACHE else @@ -55,7 +55,7 @@ else # set to use different directory here because upon RPM removal this # directory will be wiped in daily UPSTREAM_CACHE=$HOME/upstream_cache - if [ "$BRANCH" == 'master' ]; then + if [[ "$BRANCH" != 'stable/fraser' ]]; then mkdir -p ${UPSTREAM_CACHE} RESOURCES=$UPSTREAM_CACHE else @@ -161,11 +161,6 @@ else DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}" fi -if [[ "$BRANCH" == "master" ]]; then - echo "Upstream deployment detected" - DEPLOY_CMD="${DEPLOY_CMD} --upstream" -fi - if [ "$IPV6_FLAG" == "True" ]; then NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml" elif [[ "$PROMOTE" == "True" ]]; then diff --git a/jjb/apex/apex-download-artifact.sh b/jjb/apex/apex-download-artifact.sh index e1e51b3b6..10efbe1a2 100755 --- a/jjb/apex/apex-download-artifact.sh +++ b/jjb/apex/apex-download-artifact.sh @@ -18,8 +18,8 @@ else fi if [[ "$ARTIFACT_VERSION" =~ dev ]]; then - if [ "$BRANCH" == 'master' ]; then - echo "Skipping download of artifacts for master branch" + if [[ "$BRANCH" != 'stable/fraser' ]]; then + echo "Skipping download of artifacts for master/gambia branch" else # dev build GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$') diff --git a/jjb/apex/apex-iso-verify.sh b/jjb/apex/apex-iso-verify.sh index f34937619..c29d7cb32 100755 --- a/jjb/apex/apex-iso-verify.sh +++ b/jjb/apex/apex-iso-verify.sh @@ -8,8 +8,8 @@ echo "Starting the Apex iso verify." echo "--------------------------------------------------------" echo -if [ "$BRANCH" == 'master' ]; then - echo "Skipping Apex iso verify for master branch" +if [ "$BRANCH" != 'stable/fraser' ]; then + echo "Skipping Apex iso verify for ${BRANCH} branch" exit 0 fi diff --git a/jjb/apex/apex-upload-artifact.sh b/jjb/apex/apex-upload-artifact.sh index 5c777a824..07198b188 100755 --- a/jjb/apex/apex-upload-artifact.sh +++ b/jjb/apex/apex-upload-artifact.sh @@ -114,8 +114,8 @@ fi if [ "$ARTIFACT_TYPE" == 'snapshot' ]; then uploadsnap elif [ "$ARTIFACT_TYPE" == 'iso' ]; then - if [[ "$ARTIFACT_VERSION" =~ dev || "$BRANCH" == 'master' ]]; then - echo "Skipping ISO artifact upload for ${ARTIFACT_TYPE} due to dev/master build" + if [[ "$ARTIFACT_VERSION" =~ dev || "$BRANCH" != 'stable/fraser' ]]; then + echo "Skipping ISO artifact upload for ${ARTIFACT_TYPE} due to dev/${BRANCH} build" exit 0 fi if [[ -n "$SIGN_ARTIFACT" && "$SIGN_ARTIFACT" == "true" ]]; then @@ -124,8 +124,8 @@ elif [ "$ARTIFACT_TYPE" == 'iso' ]; then uploadiso elif [ "$ARTIFACT_TYPE" == 'rpm' ]; then if [[ "$ARTIFACT_VERSION" =~ dev ]]; then - if [ "$BRANCH" == 'master' ]; then - echo "will not upload artifacts, master uses upstream" + if [[ "$BRANCH" != 'stable/fraser' ]]; then + echo "will not upload artifacts, ${BRANCH} uses upstream" ARTIFACT_TYPE=none else echo "dev build detected, will upload image tarball" @@ -138,7 +138,7 @@ elif [ "$ARTIFACT_TYPE" == 'rpm' ]; then RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL) SRPM_INSTALL_PATH=$BUILD_DIRECTORY SRPM_LIST=$SRPM_INSTALL_PATH/$(basename $OPNFV_SRPM_URL) - if [ "$BRANCH" != 'master' ]; then + if [[ "$BRANCH" == 'stable/fraser' ]]; then VERSION_EXTENSION=$(echo $(basename $OPNFV_RPM_URL) | sed 's/opnfv-apex-//') RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-undercloud-${VERSION_EXTENSION}" RPM_LIST+=" ${RPM_INSTALL_PATH}/python34-opnfv-apex-${VERSION_EXTENSION}" -- cgit 1.2.3-korg