From: Fatih Degirmenci Date: Mon, 16 Dec 2019 10:26:46 +0000 (+0100) Subject: cloud-infra: Install shellcheck from snap X-Git-Url: https://gerrit.nordix.org/gitweb?a=commitdiff_plain;h=bb108fab9a0a90753db0428e0a19b35148275a3d;p=infra%2Fcicd.git cloud-infra: Install shellcheck from snap apt does not have shellcheck v0.7.0 so shellcheck is installed from snap instead. Change-Id: I243279402de73fad3d0f3c7e1067c9feffcc1a07 --- diff --git a/jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh b/jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh index 6c6f69a21..48ea0fcb2 100644 --- a/jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh +++ b/jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh @@ -20,7 +20,13 @@ # install dependencies sudo apt update > /dev/null 2>&1 -sudo apt install -y -q=3 shellcheck > /dev/null 2>&1 +sudo apt remove -y -q=3 shellcheck > /dev/null 2>&1 + +# apt doesn't have the shellcheck version v0.7.0 so we install +# it from snap +sudo snap install shellcheck +SHELLCHECK_EXECUTABLE=/snap/bin/shellcheck +echo "Info: Using shellcheck version $(${SHELLCHECK_EXECUTABLE} --version)" cd $WORKSPACE echo "Info: Run shellcheck on bash scripts" @@ -33,7 +39,7 @@ declare -i exit_code=0 # lint the bash scripts for shell_script in $(find ${WORKSPACE}/ -type f -name *.sh); do echo "--> Checking '${shell_script}' shell script..." - shellcheck --color=never --source-path="${WORKSPACE}" --external-sources \ + "${SHELLCHECK_EXECUTABLE}" --color=never --source-path="${WORKSPACE}" --external-sources \ --format=tty ${shell_script} lint_exit_code=$? if [[ $lint_exit_code != 0 ]]; then