File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ name: Continuous Integration Tests
22
33on :
44 pull_request :
5+ push :
6+ branches :
7+ - other/scan-notification
58
69jobs :
710 unit-tests :
@@ -145,41 +148,3 @@ jobs:
145148 with :
146149 go-version-file : go.mod
147150 go-package : ./...
148-
149- checkDockerImage :
150- runs-on : ubuntu-latest
151- name : scan Docker Image with Trivy
152- steps :
153- - name : Checkout code
154- uses : actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598 # 2.0.0
155-
156-
157- - name : Set up Docker
158- uses : docker/setup-buildx-action@cf09c5c41b299b55c366aff30022701412eb6ab0 # v1.0.0
159-
160- - name : Log in to Docker Hub
161- uses : docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2
162- with :
163- username : ${{ secrets.DOCKER_USERNAME }}
164- password : ${{ secrets.DOCKER_PASSWORD }}
165- - name : Build the project
166- run : go build -o ./cx ./cmd
167- - name : Build Docker image
168- run : docker build -t ast-cli:${{ github.sha }} .
169- - name : Run Trivy scanner without downloading DBs
170- uses : aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # v0.28.0
171- with :
172- scan-type : ' image'
173- image-ref : ast-cli:${{ github.sha }}
174- format : ' table'
175- exit-code : ' 1'
176- ignore-unfixed : true
177- vuln-type : ' os,library'
178- output : ' ./trivy-image-results.txt'
179- env :
180- TRIVY_SKIP_JAVA_DB_UPDATE : true
181-
182- - name : Inspect action report
183- if : always()
184- shell : bash
185- run : cat ./trivy-image-results.txt
Original file line number Diff line number Diff line change 1+ name : Docker Image Security Scan
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - other/scan-notification
8+ # workflow_run:
9+ # workflows: ["Continuous Integration Tests"]
10+ # types:
11+ # - completed
12+
13+ jobs :
14+ checkDockerImage :
15+ name : Scan Docker Image with Trivy
16+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@722adc63f1aa60a57ec37892e133b1d319cae598
22+
23+ - name : Set up Go
24+ uses : actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9
25+ with :
26+ go-version-file : go.mod
27+
28+ - name : Set up Docker Buildx
29+ uses : docker/setup-buildx-action@cf09c5c41b299b55c366aff30022701412eb6ab0
30+
31+ - name : Log in to Docker Hub
32+ uses : docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
33+ with :
34+ username : ${{ secrets.DOCKER_USERNAME }}
35+ password : ${{ secrets.DOCKER_PASSWORD }}
36+
37+ - name : Build the project
38+ run : go build -o ./cx ./cmd
39+
40+ - name : Build Docker image
41+ run : docker build -t ast-cli:${{ github.event.workflow_run.head_sha }} .
42+
43+ - name : Run Trivy scan
44+ uses : aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2
45+ with :
46+ scan-type : image
47+ image-ref : ast-cli:${{ github.event.workflow_run.head_sha }}
48+ format : table
49+ exit-code : 1
50+ ignore-unfixed : true
51+ vuln-type : os,library
52+ output : trivy-image-results.txt
53+ env :
54+ TRIVY_SKIP_JAVA_DB_UPDATE : true
55+
56+ - name : Show scan results
57+ if : always()
58+ run : cat trivy-image-results.txt
You can’t perform that action at this time.
0 commit comments