Apply exit code to hadolint.sh

This commit is contained in:
Paul Barton 2022-03-24 12:57:02 +00:00
parent 96339c1113
commit 63666e594d

View file

@ -27,16 +27,19 @@ if [ -n "$HADOLINT_OUTPUT" ]; then
OUTPUT=" | tee $HADOLINT_OUTPUT" OUTPUT=" | tee $HADOLINT_OUTPUT"
fi fi
FAILED=0
if [ "$HADOLINT_RECURSIVE" = "true" ]; then if [ "$HADOLINT_RECURSIVE" = "true" ]; then
shopt -s globstar shopt -s globstar
filename="${!#}" filename="${!#}"
flags="${@:1:$#-1}" flags="${@:1:$#-1}"
hadolint $HADOLINT_CONFIG $flags **/$filename $OUTPUT hadolint $HADOLINT_CONFIG $flags **/$filename $OUTPUT || FAILED=1
else else
# shellcheck disable=SC2086 # shellcheck disable=SC2086
hadolint $HADOLINT_CONFIG "$@" $OUTPUT hadolint $HADOLINT_CONFIG "$@" $OUTPUT || FAILED=1
fi fi
[ -z "$HADOLINT_OUTPUT" ] || echo "Hadolint output saved to: $HADOLINT_OUTPUT" [ -z "$HADOLINT_OUTPUT" ] || echo "Hadolint output saved to: $HADOLINT_OUTPUT"
exit $FAILED