From bcb5d29e906cf3d622dff81152456d088d79793a Mon Sep 17 00:00:00 2001 From: Yuval Goldberg Date: Mon, 6 Sep 2021 00:57:24 +0300 Subject: [PATCH] Fix shellcheck output streams Resolves https://github.com/kubernetes/kubernetes/issues/102975 shellcheck errors are printed to stdout by default, hence they need to be redirected to stderr in order to be well parsed for Junit representation by `juLog` function. --- hack/verify-shellcheck.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hack/verify-shellcheck.sh b/hack/verify-shellcheck.sh index 165522d8e5b..c6a506e8db9 100755 --- a/hack/verify-shellcheck.sh +++ b/hack/verify-shellcheck.sh @@ -102,16 +102,18 @@ SHELLCHECK_OPTIONS=( ) # tell the user which we've selected and lint all scripts +# The shellcheck errors are printed to stdout by default, hence they need to be redirected +# to stderr in order to be well parsed for Junit representation by juLog function res=0 if ${HAVE_SHELLCHECK}; then echo "Using host shellcheck ${SHELLCHECK_VERSION} binary." - shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" || res=$? + shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" >&2 || res=$? else echo "Using shellcheck ${SHELLCHECK_VERSION} docker image." "${DOCKER}" run \ --rm -v "${KUBE_ROOT}:${KUBE_ROOT}" -w "${KUBE_ROOT}" \ "${SHELLCHECK_IMAGE}" \ - shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" || res=$? + shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" >&2 || res=$? fi # print a message based on the result