Skip to content

Commit bf2e7fc

Browse files
committed
chore/security : continue ci on trivy-scan fail
1 parent 8713c2c commit bf2e7fc

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/dispatcher-build.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)