Skip to content

Commit 7843ec0

Browse files
authored
feat: Add Trivy scans to images (trustyai-explainability#346)
* feat: Add Trivy scans to images * Fix format and action name * Revert to table format * fix: Reuse built container for scans * fix: Fix typo
1 parent ad5b87b commit 7843ec0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/build-and-push.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
# Ensure that tests pass before publishing a new image.
2424
build-and-push-ci:
2525
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
security-events: write
2629
steps: # Assign context variable for various action contexts (tag, main, CI)
2730
- name: Assigning CI context
2831
if: github.head_ref != '' && github.head_ref != 'main' && !startsWith(github.ref, 'refs/tags/v')
@@ -169,3 +172,19 @@ jobs:
169172
sourcePath: ''
170173
uri: https://api.github.com/repos/trustyai-explainability/trustyai-service-operator-ci/tarball/operator-${{ env.TAG }}
171174
```
175+
- name: Trivy scan
176+
uses: aquasecurity/[email protected]
177+
with:
178+
scan-type: 'image'
179+
image-ref: "${{ env.IMAGE_NAME }}:${{ env.TAG }}"
180+
format: 'sarif'
181+
output: 'trivy-results.sarif'
182+
severity: 'MEDIUM,HIGH,CRITICAL'
183+
exit-code: '0'
184+
ignore-unfixed: false
185+
vuln-type: 'os,library'
186+
187+
- name: Update Security tab
188+
uses: github/codeql-action/upload-sarif@v3
189+
with:
190+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)