Merge pull request #50 from paulbarton90/check_exit_status

Apply exit code to hadolint.sh
This commit is contained in:
José Lorenzo Rodríguez 2022-03-24 14:57:38 +01:00 committed by GitHub
commit 2bcb99c6e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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