Apex: Fixes branch checking 35/63035/1
authorTim Rozet <trozet@redhat.com>
Fri, 28 Sep 2018 19:09:31 +0000 (15:09 -0400)
committerTim Rozet <trozet@redhat.com>
Fri, 28 Sep 2018 19:09:31 +0000 (15:09 -0400)
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 <trozet@redhat.com>
jjb/apex/apex-build.sh
jjb/apex/apex-deploy.sh
jjb/apex/apex-download-artifact.sh
jjb/apex/apex-iso-verify.sh
jjb/apex/apex-upload-artifact.sh

index 09aa716..a8ed1f8 100755 (executable)
@@ -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/
index 441bf90..1bc727d 100755 (executable)
@@ -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
index e1e51b3..10efbe1 100755 (executable)
@@ -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]+$')
index f349376..c29d7cb 100755 (executable)
@@ -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
 
index 5c777a8..07198b1 100755 (executable)
@@ -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}"