Revert "Fix: bashisms - step 2" 95/102295/1
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 6 Sep 2022 07:23:12 +0000 (17:23 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Tue, 6 Sep 2022 07:28:44 +0000 (17:28 +1000)
This reverts commit 71ab2645c80c9c6c8c7f9eec9ca6e350dc1ee272.

The original commits fails the openstack jobs with the following error:

[builder-update-image-list] $ /bin/sh -l /tmp/jenkins9084563766671196003.sh
/home/jenkins/lf-env.sh: line 44: `lf-echo-stderr': not a valid identifier

Change-Id: I4d4d3ba08fe36f2b2e385bdfdd5918fa24b09e36
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jenkins-init-scripts/system_type.sh
jjb/autorelease/autorelease-gerrit-branch-lock.sh
jjb/netvirt/quagga-build.sh
jjb/opendaylight-infra-stack.sh
jjb/opendaylight-infra-update-image-list.sh
jjb/packaging/helm-repo-init.sh

index 897e694db520f5f27287442f9d498dec017d024d..c5b141afd47d859d9384915f0247f905c0bd2748 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2016 The Linux Foundation and others.
@@ -22,7 +22,7 @@ for i in "java-builder,builder" \
          "robot,robot" \
          "mininet,mininet-ubuntu"
 do set -- $i
-    if expr $HOST : ".*$1.*" ; then
+    if [[ $HOST == *"$1"* ]]; then
         SYSTEM_TYPE="$2"
         break
     fi
index 1d196496f5f6fe6fec0a968e1a898f0da2d26002..e3c6a8bfe17c9f4eb8f26ec94968173da861a9eb 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2022 The Linux Foundation and others.
@@ -48,7 +48,7 @@ mode="${GERRIT_ACCESS_MODE}"
 set -x
 case $mode in
     branch-cut)
-        if [ "${GERRIT_BRANCH}" = "master" ] && expr "${GERRIT_BRANCH_NEXT}" : "stable/.*"; then
+        if [ "${GERRIT_BRANCH}" == "master" ] && [[ "${GERRIT_BRANCH_NEXT}" =~ stable ]]; then
             echo "INFO: Locking branch for new branch cutting: ${GERRIT_BRANCH_NEXT}"
             git config -f project.config "access.refs/for/refs/heads/${GERRIT_BRANCH_NEXT}.exclusiveGroupPermissions" "create"
             git config -f project.config "access.refs/for/refs/heads/${GERRIT_BRANCH_NEXT}.create" "block group Registered Users"
index 63199dc6cf28bd6f6e75967b85af2522664463a7..294601ebd8a159ae1f0f5b0f505b5bf9d40c6f7e 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2018 The Linux Foundation and others.
@@ -15,8 +15,7 @@ set -e -x
 # The script builds 6wind/quagga source and binary packages from zrpcd
 # repository for testing router functionalities with Netvirt jobs, .
 
-initdir=$(pwd)
-cd "$(pwd)/zrpcd"
+pushd "$(pwd)/zrpcd"
 
 chmod a+x "$(pwd)/pkgsrc/dev_compile_script.sh"
 cd "$(pwd)/pkgsrc" && sudo "./dev_compile_script.sh" -p -d -b -v "$QUAGGA_VERSION"
@@ -39,7 +38,7 @@ case "$OS" in
     ;;
 esac
 
-cd $initdir
+popd
 
 # todo: remove below lines once the scripts in zrpcd repos build the src packages.
 # Ref: https://lists.opendaylight.org/pipermail/integration-dev/2018-July/012330.html
index 6c12f0489c1dd71b940c189140458e3846200f54..58ad381747124e312a3684aa37b11c960d0c13b7 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh -l
+#!/bin/bash -l
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
@@ -77,7 +77,7 @@ for try in $(seq $STACK_RETRIES); do
                     sleep 30
                     delete_status=$(openstack stack show "$STACK_NAME" -f value -c stack_status)
                     echo "$j: $delete_status"
-                    if [ "$delete_status" = "DELETE_FAILED" ]; then
+                    if [[ $delete_status == "DELETE_FAILED" ]]; then
                         reason=$(openstack stack show "$STACK_NAME" -f value -c stack_status_reason)
                         echo "ERROR: Failed to delete $STACK_NAME. Reason: $reason"
 
index eb3a50f6a9ebf030c0843ffc8c08b153cb705757..c7ac71731cd2ac10abf868a035c16e896a2ed03c 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh -l
+#!/bin/bash -l
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
@@ -32,13 +32,12 @@ Following are the list of published images available to Jenkins jobs.
 EOF
 # Blank line before EOF is on purpose to ensure there is spacing.
 
-IFS='
-'
+IFS=$'\n'
 # We purposely want globbing here to build images list
 # shellcheck disable=SC2207
-IMAGES="$(openstack image list --long -f value -c Name -c Protected \
-    | grep 'ZZCI.*True' | sed 's/ True//')"
-for i in $IMAGES; do
+IMAGES=($(openstack image list --long -f value -c Name -c Protected \
+    | grep 'ZZCI.*True' | sed 's/ True//'))
+for i in "${IMAGES[@]}"; do
     echo "Adding image $i"
     echo "* $i" >> "$WORKSPACE/docs/cloud-images.rst"
 done
index 54e5d67f85eaa4eae81dcd6cc89f80cea0011ec8..5d584d2dbab812001f7d51a8ea545fa03caead0f 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
@@ -14,7 +14,7 @@ set -e -o pipefail
 
 mkdir -p ".chartstorage"
 
-chartmuseum --port=6464 --storage="local" --storage-local-rootdir=".chartstorage" >/dev/null 2>&1 &
+chartmuseum --port=6464 --storage="local" --storage-local-rootdir=".chartstorage" &> /dev/null &
 . helm.prop
 $HELM_BIN plugin install --version v0.9.0 https://github.com/chartmuseum/helm-push.git || true
 $HELM_BIN repo add local http://localhost:6464