File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,12 +85,13 @@ jobs:
8585 --image ghcr.io/${{ github.repository_owner }}/dispatcher:$IMAGE_TAG
8686 - name : Scan Dispatcher Docker image
8787 uses : aquasecurity/trivy-action@0.33.1
88+ continue-on-error : true
8889 with :
8990 image-ref : ' ghcr.io/${{ github.repository_owner }}/dispatcher:${{ needs.get-tags.outputs.dispatcher-version }}-model-${{ matrix.model_version }}'
9091 format : ' sarif'
9192 output : ' trivy-dispatcher-${{ matrix.model_version }}-image.sarif'
9293 severity : ' HIGH,CRITICAL'
93- exit-code : ' 1 '
94+ exit-code : ' 0 '
9495 - name : Upload Dispatcher image scan results to GitHub Security tab
9596 if : always() && hashFiles('trivy-dispatcher-${{ matrix.model_version }}-image.sarif') != ''
9697 uses : github/codeql-action/upload-sarif@v3
@@ -104,3 +105,18 @@ jobs:
104105 name : trivy-reports-dispatcher-${{ matrix.model_version }}-image
105106 path : ' *.sarif'
106107 retention-days : 7
108+ - name : Check for vulnerabilities
109+ run : |
110+ if [ -f "trivy-dispatcher-${{ matrix.model_version }}-image.sarif" ]; then
111+ # Check if the SARIF file contains any results indicating vulnerabilities
112+ if grep -q '"results":\s*\[.*\]' "trivy-dispatcher-${{ matrix.model_version }}-image.sarif" && ! grep -q '"results":\s*\[\s*\]' "trivy-dispatcher-${{ matrix.model_version }}-image.sarif"; then
113+ echo "HIGH or CRITICAL vulnerabilities found in dispatcher image"
114+ echo "Please check the security scan results in the Security tab"
115+ exit 1
116+ else
117+ echo "No HIGH or CRITICAL vulnerabilities found"
118+ fi
119+ else
120+ echo "SARIF report not found"
121+ exit 1
122+ fi
You can’t perform that action at this time.
0 commit comments