Skip to content

Commit 988a72a

Browse files
committed
Use scanners option for Trivy, add Trivy to test action
The trivy-action action removed the security-checks option in favor of the scanners option recently. This commit updates the existing image scanning action to use the right option and also adds image scanning to the test action. Signed-off-by: John Schaeffer <[email protected]>
1 parent f12495e commit 988a72a

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

.github/workflows/image-build.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
- name: Run Trivy vulnerability scanner
4444
uses: aquasecurity/trivy-action@master
4545
with:
46-
image-ref: ${{ steps.docker-metadata.outputs.tags }}
47-
security-checks: 'vuln,config,secret'
46+
image-ref: ghcr.io/infratographer/permissions-api/permissions-api:latest
47+
scanners: 'vuln,config,secret'
4848
ignore-unfixed: true
4949
severity: 'HIGH,CRITICAL'
5050
format: 'table'

.github/workflows/test.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,44 @@ jobs:
4040

4141
- name: Run go tests
4242
run: make test
43+
44+
image-scan:
45+
name: image-scan
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v3
51+
52+
- name: Registry login
53+
uses: docker/login-action@v2
54+
with:
55+
registry: ghcr.io
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Docker metadata
60+
id: metadata
61+
uses: docker/metadata-action@v4
62+
with:
63+
images: |
64+
ghcr.io/${{ github.repository }}
65+
tags: |
66+
type=sha
67+
68+
- name: Build
69+
uses: docker/build-push-action@v4
70+
with:
71+
context: .
72+
push: false
73+
load: true
74+
tags: ${{ steps.metadata.outputs.tags }}
75+
76+
- name: Run Trivy vulnerability scanner
77+
uses: aquasecurity/trivy-action@master
78+
with:
79+
image-ref: ghcr.io/infratographer/permissions-api/permissions-api:${{ steps.docker-metadata.outputs.tags }}
80+
scanners: 'vuln,config,secret'
81+
ignore-unfixed: true
82+
severity: 'HIGH,CRITICAL'
83+
format: 'table'

0 commit comments

Comments
 (0)