-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Trivy Security Scanner | ||
on: | ||
push: | ||
branches: | ||
- 3-22.04 | ||
pull_request: | ||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yaml | ||
scan: | ||
name: Trivy scan | ||
needs: build | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
run: | | ||
sudo snap install rockcraft --classic --edge | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: charmed-karapace | ||
- name: Import locally | ||
run: | | ||
sudo rockcraft.skopeo --insecure-policy copy \ | ||
oci-archive:${{ needs.build.outputs.rock }} \ | ||
docker-daemon:trivy/charmed-karapace:test | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: 'trivy/charmed-karapace:test' | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'MEDIUM,HIGH,CRITICAL' | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
if: always() | ||
with: | ||
sarif_file: 'trivy-results.sarif' |