Skip to content

Commit

Permalink
Don't try to upload if sast/clamav file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jun 20, 2024
1 parent 1e82760 commit 083fe73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions task/clamav-scan/0.1/clamav-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions task/sast-snyk-check/0.1/sast-snyk-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 083fe73

Please sign in to comment.