-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Trivy image scan to a scheduled workflow (#267)
- Loading branch information
Showing
2 changed files
with
49 additions
and
11 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 |
---|---|---|
|
@@ -55,14 +55,4 @@ jobs: | |
context: . | ||
load: true | ||
tags: pxwebapi:${{ github.sha }} | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: image | ||
image-ref: pxwebapi:${{ github.sha }} | ||
format: sarif | ||
output: trivy-results.sarif | ||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: trivy-results.sarif | ||
|
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,48 @@ | ||
name: Trivy Image Scan | ||
on: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "5 11 * * 0" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
docker: | ||
permissions: | ||
contents: read | ||
security-events: write | ||
actions: read | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
load: true | ||
tags: pxwebapi:${{ github.sha }} | ||
|
||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: image | ||
image-ref: pxwebapi:${{ github.sha }} | ||
format: sarif | ||
output: trivy-results.sarif | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: trivy-results.sarif |