From 65a66b9d7f08897b92dc6f9789f4f2fe4fc85e97 Mon Sep 17 00:00:00 2001 From: Odin Ugedal Date: Wed, 23 Oct 2019 19:55:44 +0200 Subject: [PATCH] Bump shellcheck to v0.7.0 Changelog: https://github.com/koalaman/shellcheck/blob/master/CHANGELOG.md We have some new erros due to the version bump. - SC2034: VARIABLE_XYZ appears unused. Verify use (or export if used externally). - Applies to all scripts we source in other scripts - SC2039: In POSIX sh, set option pipefail is undefined. - Applies to files using it with "sh" instead of "bash" in the shebang - SC2054: Use spaces, not commas, to separate array elements. - Fixing Should make no difference in the code - SC2128: Expanding an array without an index only gives the first element. - Fixing Should make no difference in the code - SC2251: This ! is not on a condition and skips errexit. Use `&& exit 1` instead, or make sure $? is checked. - Not 100% sure if we can swap to `&& exit 1`. Applies to a lot of test code. All changes should be straight forward to fix, but will be done in a separate PR. --- hack/.shellcheck_failures | 13 +++++++++++++ hack/verify-shellcheck.sh | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 82638a92176..783ee0f7eb1 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -1,3 +1,4 @@ +./build/common.sh ./build/lib/release.sh ./cluster/common.sh ./cluster/gce/config-default.sh @@ -6,7 +7,19 @@ ./cluster/gce/gci/configure.sh ./cluster/gce/gci/health-monitor.sh ./cluster/gce/gci/master-helper.sh +./cluster/gce/gci/mounter/stage-upload.sh ./cluster/gce/upgrade.sh ./cluster/gce/util.sh ./cluster/log-dump/log-dump.sh ./cluster/pre-existing/util.sh +./hack/lib/golang.sh +./hack/lib/test.sh +./test/cmd/apply.sh +./test/cmd/apps.sh +./test/cmd/core.sh +./test/cmd/crd.sh +./test/cmd/create.sh +./test/cmd/generic-resources.sh +./test/cmd/save-config.sh +./test/images/pets/redis-installer/on-start.sh +./test/images/pets/zookeeper-installer/on-start.sh diff --git a/hack/verify-shellcheck.sh b/hack/verify-shellcheck.sh index 2852c66df2b..9a87f4ca3c1 100755 --- a/hack/verify-shellcheck.sh +++ b/hack/verify-shellcheck.sh @@ -24,9 +24,9 @@ source "${KUBE_ROOT}/hack/lib/util.sh" # required version for this script, if not installed on the host we will # use the official docker image instead. keep this in sync with SHELLCHECK_IMAGE -SHELLCHECK_VERSION="0.6.0" -# upstream shellcheck latest stable image as of January 10th, 2019 -SHELLCHECK_IMAGE="koalaman/shellcheck-alpine:v0.6.0@sha256:7d4d712a2686da99d37580b4e2f45eb658b74e4b01caf67c1099adc294b96b52" +SHELLCHECK_VERSION="0.7.0" +# upstream shellcheck latest stable image as of October 23rd, 2019 +SHELLCHECK_IMAGE="koalaman/shellcheck-alpine:v0.7.0@sha256:24bbf52aae6eaa27accc9f61de32d30a1498555e6ef452966d0702ff06f38ecb" # fixed name for the shellcheck docker container so we can reliably clean it up SHELLCHECK_CONTAINER="k8s-shellcheck"