Resolve shellcheck for autorelease scripts 15/83515/2
authorThanh Ha <zxiiro@gmail.com>
Thu, 8 Aug 2019 00:30:51 +0000 (20:30 -0400)
committerThanh Ha <zxiiro@gmail.com>
Thu, 8 Aug 2019 00:36:46 +0000 (20:36 -0400)
Change-Id: Iad10f5f95910e41ec821063c2f317c2284c3ede9
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
jjb/autorelease/autorelease-get-integration-test-variables.sh
jjb/autorelease/compare-autorelease-projects.sh
jjb/autorelease/notify-build-failure.sh
jjb/autorelease/update-autorelease-projects-views.sh

index ad4a7015d5dc5999541ac543a79778338b6a7326..95ff652ae7e723842b87c0239238304a5f995085 100644 (file)
@@ -21,6 +21,7 @@ VERSION=$(grep -m2 '<version>' "${WORKSPACE}/integration/distribution/${KARAF_AR
 echo "VERSION: ${VERSION}"
 STAGING_REPO_ID=$(grep "$NEXUS_STAGING_URL" "$WORKSPACE/archives/staging-repo.txt" | awk '{print $1}')
 BUNDLE_URL="${NEXUSURL}/${STAGING_REPO_ID}/org/opendaylight/integration/${KARAF_ARTIFACT}/${VERSION}/${KARAF_ARTIFACT}-${VERSION}.zip"
+# shellcheck disable=SC2129
 echo STAGING_REPO_ID="$STAGING_REPO_ID" >> "$WORKSPACE/variables.prop"
 echo BUNDLE_URL="$BUNDLE_URL" >> "$WORKSPACE/variables.prop"
 echo KARAF_VERSION="$KARAF_VERSION" >> "$WORKSPACE/variables.prop"
index 6f63a660cbf7e36e6149cd768ed5792eca5e9cc7..118cf30bd6fffef6467424642c2f7fb2059b02b5 100644 (file)
@@ -27,8 +27,8 @@ for project in "${PROJECTS_INT_DIST[@]}"; do
     if [[ $project =~ project.groupId ]] || [[ $project =~ odlparent ]]; then
         continue
     elif [[ $project =~ org.opendaylight ]]; then
-        project=$(echo "${project/org.opendaylight./}")
-        project_int_dist+=( "$(echo "${project/.//}" )" )
+        project=${project/org.opendaylight./}
+        project_int_dist+=("${project/.//}")
     fi
 done
 
index a5c5c82bbe10b2678f94d9b70747fe009793ffa1..6eafef7b4383d1bf4687aec1876b03cc9d62ef4a 100644 (file)
@@ -60,7 +60,7 @@ ARTIFACT_ID=$(awk -F: '/\[ERROR\].*mvn <goals> -rf :/ { print $2}' $CONSOLE_LOG)
 #     project.groupId is not set but IS inherited from project.parent.groupId
 # else
 #     exclude project mailing list
-if [ ! -z "$ARTIFACT_ID" ]; then
+if [ -n "$ARTIFACT_ID" ]; then
     grouplist=()
     while IFS="" read -r p; do
         GROUP=$(xmlstarlet sel\
@@ -72,7 +72,7 @@ if [ ! -z "$ARTIFACT_ID" ]; then
               -v "/x:project/x:parent/x:groupId"\
               --else -o ""\
               "$p" 2>/dev/null)
-        if [ ! -z "${GROUP}" ]; then
+        if [ -n "${GROUP}" ]; then
             # shellcheck disable=SC2207
             grouplist+=($(echo "${GROUP}" | awk -F'.' '{ print $3 }'))
         fi
@@ -122,7 +122,8 @@ ODL releng/autorelease team
 BUILD_STATUS=$(awk '/\[INFO\] Remote staging finished/{flag=1;next}/Total time:/{flag=0}flag' $CONSOLE_LOG \
                    | grep '\] BUILD' | awk '{print $3}')
 
-if ([ ! -z "${NAME}" ] || [ ! -z "${ARTIFACT_ID}" ]) && [[ "${BUILD_STATUS}" != "SUCCESS" ]]; then
+# shellcheck disable=SC2235
+if ([ -n "${NAME}" ] || [ -n "${ARTIFACT_ID}" ]) && [[ "${BUILD_STATUS}" != "SUCCESS" ]]; then
     # project search pattern should handle both scenarios
     # 1. Full format:    ODL :: $PROJECT :: $ARTIFACT_ID
     # 2. Partial format: Building $ARTIFACT_ID
index b3cfe9036f6f449385b50a3689bf86b8074967d1..ecb8472c45bde549b9c57dc737e4a99de224ded5 100755 (executable)
@@ -61,5 +61,5 @@ echo "    <<: *releng_autorelease_view_common_${STREAM}" >> "$VIEWS_AR_YAML_FILE
 
 git add "${VIEWS_AR_YAML_FILE}"
 
-mkdir -p ${WORKSPACE}/archives
-cp "${VIEWS_AR_YAML_FILE}" ${WORKSPACE}/archives
+mkdir -p "${WORKSPACE}/archives"
+cp "${VIEWS_AR_YAML_FILE}" "${WORKSPACE}/archives"