Skip to content

Commit 0f7fa64

Browse files
authored
Merge pull request #708 from andyzhangx/trivy
test: add tirvy vulnerability scanner github action
2 parents 3cf7137 + 3072a81 commit 0f7fa64

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/trivy.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Trivy vulnerability scanner
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Install go
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: ^1.16
19+
20+
- name: Build images from Dockerfile
21+
run: |
22+
make
23+
docker build -t test/csi-snapshotter:latest -f ./cmd/csi-snapshotter/Dockerfile --output=type=docker --label revision=latest .
24+
docker build -t test/snapshot-controller:latest -f ./cmd/snapshot-controller/Dockerfile --output=type=docker --label revision=latest .
25+
docker build -t test/snapshot-validation-webhook:latest -f ./cmd/snapshot-validation-webhook/Dockerfile --output=type=docker --label revision=latest .
26+
27+
- name: Run Trivy vulnerability scanner on csi-snapshotter image
28+
uses: aquasecurity/trivy-action@master
29+
with:
30+
image-ref: 'test/csi-snapshotter:latest'
31+
format: 'table'
32+
exit-code: '1'
33+
ignore-unfixed: true
34+
vuln-type: 'os,library'
35+
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
36+
37+
- name: Run Trivy vulnerability scanner on snapshotter-controller image
38+
uses: aquasecurity/trivy-action@master
39+
with:
40+
image-ref: 'test/snapshot-controller:latest'
41+
format: 'table'
42+
exit-code: '1'
43+
ignore-unfixed: true
44+
vuln-type: 'os,library'
45+
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
46+
47+
- name: Run Trivy vulnerability scanner on snapshot-validation-webhook image
48+
uses: aquasecurity/trivy-action@master
49+
with:
50+
image-ref: 'test/snapshot-validation-webhook:latest'
51+
format: 'table'
52+
exit-code: '1'
53+
ignore-unfixed: true
54+
vuln-type: 'os,library'
55+
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'

0 commit comments

Comments
 (0)