From 63666e594d2012fe7ba9d06d80efbbad3d8fd440 Mon Sep 17 00:00:00 2001 From: Paul Barton <28630076+paulbarton90@users.noreply.github.com> Date: Thu, 24 Mar 2022 12:57:02 +0000 Subject: [PATCH] Apply exit code to hadolint.sh --- hadolint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hadolint.sh b/hadolint.sh index cb4df62..b8a9911 100755 --- a/hadolint.sh +++ b/hadolint.sh @@ -27,16 +27,19 @@ if [ -n "$HADOLINT_OUTPUT" ]; then OUTPUT=" | tee $HADOLINT_OUTPUT" fi +FAILED=0 if [ "$HADOLINT_RECURSIVE" = "true" ]; then shopt -s globstar filename="${!#}" flags="${@:1:$#-1}" - hadolint $HADOLINT_CONFIG $flags **/$filename $OUTPUT + hadolint $HADOLINT_CONFIG $flags **/$filename $OUTPUT || FAILED=1 else # shellcheck disable=SC2086 - hadolint $HADOLINT_CONFIG "$@" $OUTPUT + hadolint $HADOLINT_CONFIG "$@" $OUTPUT || FAILED=1 fi [ -z "$HADOLINT_OUTPUT" ] || echo "Hadolint output saved to: $HADOLINT_OUTPUT" + +exit $FAILED