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 6c6f69a..48ea0fc 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 @@
# 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