diff --git a/task/clamav-scan/0.1/clamav-scan.yaml b/task/clamav-scan/0.1/clamav-scan.yaml index 2e25d694b4..019aefb846 100644 --- a/task/clamav-scan/0.1/clamav-scan.yaml +++ b/task/clamav-scan/0.1/clamav-scan.yaml @@ -164,6 +164,11 @@ spec: args+=("${UPLOAD_FILE}:${MEDIA_TYPE}") done + if [ -z "${args}" ]; then + echo "No files found. Skipping upload." + exit 0; + fi + echo "Selecting auth" select-oci-auth $IMAGE_URL > $HOME/auth.json echo "Attaching to ${IMAGE_URL} via the OCI 1.1 Referrers API" diff --git a/task/sast-snyk-check/0.1/sast-snyk-check.yaml b/task/sast-snyk-check/0.1/sast-snyk-check.yaml index 8a13b89941..81c1165357 100644 --- a/task/sast-snyk-check/0.1/sast-snyk-check.yaml +++ b/task/sast-snyk-check/0.1/sast-snyk-check.yaml @@ -105,13 +105,18 @@ spec: script: | #!/usr/bin/env bash + UPLOAD_FILE=sast_snyk_check_out.json + MEDIA_TYPE=application/sarif+json + if [ -z "${IMAGE_URL}" ] || [ -z "${IMAGE_DIGEST}" ]; then echo 'No image-url or image-digest param provided. Skipping upload.' exit 0; fi - UPLOAD_FILE=sast_snyk_check_out.json - MEDIA_TYPE=application/sarif+json + if [ ! -f "${UPLOAD_FILE}" ]; then + echo "No ${UPLOAD_FILE} exists. Skipping upload." + exit 0; + fi echo "Selecting auth" select-oci-auth $IMAGE_URL > $HOME/auth.json