diff --git a/task/sast-snyk-check-oci-ta/0.3/sast-snyk-check-oci-ta.yaml b/task/sast-snyk-check-oci-ta/0.3/sast-snyk-check-oci-ta.yaml index 8595a46175..b0c59218ce 100644 --- a/task/sast-snyk-check-oci-ta/0.3/sast-snyk-check-oci-ta.yaml +++ b/task/sast-snyk-check-oci-ta/0.3/sast-snyk-check-oci-ta.yaml @@ -236,8 +236,8 @@ spec: # Generation of scan stats - total_files=$(jq '[.runs[0].properties.coverage[].files] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) - supported_files=$(jq '[.runs[0].properties.coverage[] | select(.type == "SUPPORTED") | .files] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) + total_files=$(jq '[.runs[0].properties.coverage[].files // 0] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) + supported_files=$(jq '[.runs[0].properties.coverage[] | select(.type == "SUPPORTED") | .files // 0] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) # We make sure the values are 0 if no supported/total files are found total_files=${total_files:-0} diff --git a/task/sast-snyk-check/0.3/sast-snyk-check.yaml b/task/sast-snyk-check/0.3/sast-snyk-check.yaml index 138e9c61a4..2a78e65207 100644 --- a/task/sast-snyk-check/0.3/sast-snyk-check.yaml +++ b/task/sast-snyk-check/0.3/sast-snyk-check.yaml @@ -213,8 +213,8 @@ spec: # Generation of scan stats - total_files=$(jq '[.runs[0].properties.coverage[].files] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) - supported_files=$(jq '[.runs[0].properties.coverage[] | select(.type == "SUPPORTED") | .files] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) + total_files=$(jq '[.runs[0].properties.coverage[].files // 0] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) + supported_files=$(jq '[.runs[0].properties.coverage[] | select(.type == "SUPPORTED") | .files // 0] | add' "${SOURCE_CODE_DIR}"/sast_snyk_check_out.json) # We make sure the values are 0 if no supported/total files are found total_files=${total_files:-0}