Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Added Trivy to public-ci for scanning image and repo #82

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/public-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,49 @@ jobs:

- name: unit-tests
run: make test

# Trivy Scan
trivy-scan:
runs-on: ubuntu-latest
permissions: write-all
steps:

- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL'

- name: Build image
run: make image

- name: Generate .tar image
run: docker save -o vul-image.tar localhost:5000/afxdp-device-plugin:latest


- name: Run Trivy on tarballed image
uses: aquasecurity/trivy-action@master
with:
image-ref: /github/workspace/vul-image.tar
scan-type: 'fs'
ignore-unfixed: false
format: 'sarif'
output: 'trivy-image-results.sarif'
severity: 'CRITICAL'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'

- name: Print sarif file
run: cat < trivy-results.sarif

- name: Print image sarif file
run: cat trivy-image-results.sarif
Loading