From 7b07fa7d6a864cd3631a0a6f3273c6f7cd91522b Mon Sep 17 00:00:00 2001 From: Liam MacPherson <11508628+LiamMacP@users.noreply.github.com> Date: Tue, 7 Nov 2023 01:32:48 +0000 Subject: [PATCH] fix: set return code after each Trivy call (#247) This change moves the return code to outside the trivy call. This fixes #228 as the return code was not being propagated. --- entrypoint.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 26a9dae..b7be8b3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -181,13 +181,12 @@ if [ "${format}" == "sarif" ] && [ "${limitSeveritiesForSARIF}" != "true" ]; the elif [ $trivyConfig ]; then echo "Running Trivy with trivy.yaml config from: " $trivyConfig trivy --config $trivyConfig ${scanType} ${artifactRef} - returnCode=$? else echo "Running trivy with options: trivy ${scanType} ${ARGS}" "${artifactRef}" echo "Global options: " "${GLOBAL_ARGS}" trivy $GLOBAL_ARGS ${scanType} ${ARGS} ${artifactRef} - returnCode=$? fi +returnCode=$? set -e if [[ "${format}" == "github" ]]; then