From 71ab2645c80c9c6c8c7f9eec9ca6e350dc1ee272 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Fri, 12 Aug 2022 14:03:31 +0200 Subject: [PATCH] Fix: bashisms - step 2 Signed-off-by: guillaume.lambert Change-Id: Icd012c1231524a7143893281f041b090d70e4069 --- jenkins-init-scripts/system_type.sh | 4 ++-- jjb/autorelease/autorelease-gerrit-branch-lock.sh | 4 ++-- jjb/netvirt/quagga-build.sh | 7 ++++--- jjb/opendaylight-infra-stack.sh | 4 ++-- jjb/opendaylight-infra-update-image-list.sh | 11 ++++++----- jjb/packaging/helm-repo-init.sh | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/jenkins-init-scripts/system_type.sh b/jenkins-init-scripts/system_type.sh index c5b141afd..897e694db 100755 --- a/jenkins-init-scripts/system_type.sh +++ b/jenkins-init-scripts/system_type.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # 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 [[ $HOST == *"$1"* ]]; then + if expr $HOST : ".*$1.*" ; then SYSTEM_TYPE="$2" break fi diff --git a/jjb/autorelease/autorelease-gerrit-branch-lock.sh b/jjb/autorelease/autorelease-gerrit-branch-lock.sh index e3c6a8bfe..1d196496f 100644 --- a/jjb/autorelease/autorelease-gerrit-branch-lock.sh +++ b/jjb/autorelease/autorelease-gerrit-branch-lock.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # 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" ] && [[ "${GERRIT_BRANCH_NEXT}" =~ stable ]]; then + if [ "${GERRIT_BRANCH}" = "master" ] && expr "${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" diff --git a/jjb/netvirt/quagga-build.sh b/jjb/netvirt/quagga-build.sh index 294601ebd..63199dc6c 100644 --- a/jjb/netvirt/quagga-build.sh +++ b/jjb/netvirt/quagga-build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2018 The Linux Foundation and others. @@ -15,7 +15,8 @@ set -e -x # The script builds 6wind/quagga source and binary packages from zrpcd # repository for testing router functionalities with Netvirt jobs, . -pushd "$(pwd)/zrpcd" +initdir=$(pwd) +cd "$(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" @@ -38,7 +39,7 @@ case "$OS" in ;; esac -popd +cd $initdir # 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 diff --git a/jjb/opendaylight-infra-stack.sh b/jjb/opendaylight-infra-stack.sh index e1e398ab0..734a01b0f 100644 --- a/jjb/opendaylight-infra-stack.sh +++ b/jjb/opendaylight-infra-stack.sh @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/sh -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -60,7 +60,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" diff --git a/jjb/opendaylight-infra-update-image-list.sh b/jjb/opendaylight-infra-update-image-list.sh index bc507cda5..9497dbdb2 100644 --- a/jjb/opendaylight-infra-update-image-list.sh +++ b/jjb/opendaylight-infra-update-image-list.sh @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/sh -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -17,12 +17,13 @@ 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=$'\n' +IFS=' +' # 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 diff --git a/jjb/packaging/helm-repo-init.sh b/jjb/packaging/helm-repo-init.sh index 5d584d2db..54e5d67f8 100644 --- a/jjb/packaging/helm-repo-init.sh +++ b/jjb/packaging/helm-repo-init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # 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 & +chartmuseum --port=6464 --storage="local" --storage-local-rootdir=".chartstorage" >/dev/null 2>&1 & . 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 -- 2.36.6