Fix multipatch script to pass ShellCheck 48/60848/3
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 28 Jul 2017 03:33:07 +0000 (23:33 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 28 Jul 2017 03:43:14 +0000 (23:43 -0400)
Using exit 1 for cds for now but we should probably redesign this script
to use `set -e -o pipefail` in the long term.

Change-Id: I18899c80e548d4ecce701241e22aa563b83bae97
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.coafile
jjb/integration/include-raw-integration-multipatch-distribution-test.sh

index c24f766b48333f64ebfda2deebd7e6bc24d19458..844739a8a515c9025bb30575e905262580b8b35c 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -33,7 +33,6 @@ ignore = .git/**,
     jenkins-scripts/*-local-env.sh,
     jjb/integration/include-raw-integration-deploy-openstack-run-test.sh,
     jjb/integration/include-raw-integration-list-jobs.sh,
-    jjb/integration/include-raw-integration-multipatch-distribution-test.sh,
     jjb/integration/include-raw-integration-replace-block-text.sh
 shell = bash
 indent_size = 4
index f4d5cfb449a2c4f7556056b96c8492dfecefcfb5..4f7129c3aa60466e4293d98d7fbb47ace06f4791 100644 (file)
@@ -13,7 +13,7 @@ DISTRIBUTION_BRANCH_TO_BUILD=$DISTROBRANCH  #renaming variable for clarity
 
 rm -rf $BUILD_DIR
 mkdir -p $BUILD_DIR
-cd $BUILD_DIR
+cd $BUILD_DIR || exit 1
 
 # create a root pom that will contain a module for each project we have a patch for
 echo "<project>" >> $POM_FILE
@@ -65,7 +65,7 @@ do
     echo "cloning project ${PROJECT}"
     git clone "https://git.opendaylight.org/gerrit/p/${PROJECT}"
     echo "<module>${PROJECT_SHORTNAME}</module>" >> ${POM_FILE}
-    cd ${PROJECT_SHORTNAME}
+    cd ${PROJECT_SHORTNAME} || exit 1
     # For patch=controller=61/29761/5:45/29645/6, this gives 61/29761/5
     CHECKOUT=`echo ${patch} | cut -d\= -s -f 2 | cut -d\: -f 1`
     if [ "x${CHECKOUT}" != "x" ]; then
@@ -85,19 +85,19 @@ do
         git fetch "https://git.opendaylight.org/gerrit/${PROJECT}" "refs/changes/${pick}"
         git cherry-pick --ff --keep-redundant-commits FETCH_HEAD
     done
-    cd "${BUILD_DIR}"
+    cd "${BUILD_DIR}" || exit 1
 done
 
 if [ "${distribution_status}" == "not_included" ]; then
     echo "adding integration/distribution"
     # clone distribution and add it as a module in root pom
     git clone "https://git.opendaylight.org/gerrit/p/integration/distribution"
-    cd distribution
+    cd distribution || exit 1
     git checkout "${DISTRIBUTION_BRANCH_TO_BUILD}"
-    cd "${BUILD_DIR}"
+    cd "${BUILD_DIR}" || exit 1
     echo "<module>distribution</module>" >> ${POM_FILE}
 fi
 
 # finish pom file
-echo "</modules>" >> ${POM_FILE}
-echo "</project>" >> ${POM_FILE}
+echo "</modules>" >> "${POM_FILE}"
+echo "</project>" >> "${POM_FILE}"