Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit 3f85fa6

Browse files
authored
Add Trivy scan (#170)
1 parent 42c46d7 commit 3f85fa6

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- name: Build Binary
6666
run: make build
6767
- name: Cache Artifacts
68-
uses: actions/cache@v2.1.6
68+
uses: actions/cache@v2
6969
with:
7070
path: ${{ github.workspace }}/bin/manager
7171
key: nginx-ingress-operator-${{ github.run_id }}-${{ github.run_number }}
@@ -92,7 +92,7 @@ jobs:
9292
- name: Checkout Repository
9393
uses: actions/checkout@v2
9494
- name: Fetch Cached Artifacts
95-
uses: actions/cache@v2.1.6
95+
uses: actions/cache@v2
9696
with:
9797
path: ${{ github.workspace }}/bin/manager
9898
key: nginx-ingress-operator-${{ github.run_id }}-${{ github.run_number }}
@@ -102,11 +102,33 @@ jobs:
102102
uses: docker/build-push-action@v2
103103
with:
104104
context: '.'
105-
# Disable cache until https://github.com/docker/buildx/issues/681 is fixed
106-
# cache-from: type=gha
107-
# cache-to: type=gha,mode=max
105+
cache-from: type=gha
106+
cache-to: type=gha,mode=max
108107
tags: nginx/nginx-ingress-operator:${{ github.sha }}
109108
push: false
109+
pull: true
110+
load: true
111+
- name: Run Trivy vulnerability scanner
112+
uses: aquasecurity/trivy-action@0.1.0
113+
continue-on-error: true
114+
with:
115+
image-ref: nginx/nginx-ingress-operator:${{ github.sha }}
116+
format: 'template'
117+
template: '@/contrib/sarif.tpl'
118+
output: 'trivy-results.sarif'
119+
ignore-unfixed: 'true'
120+
- name: Upload Trivy scan results to GitHub Security tab
121+
uses: github/codeql-action/upload-sarif@v1
122+
continue-on-error: true
123+
with:
124+
sarif_file: 'trivy-result.sarif'
125+
- name: Upload Scan Results
126+
uses: actions/upload-artifact@v2
127+
continue-on-error: true
128+
with:
129+
name: 'trivy-results.sarif'
130+
path: 'trivy-results.sarif'
131+
if: always()
110132

111133
release-docker:
112134
name: Release Image
@@ -120,7 +142,7 @@ jobs:
120142
- name: Checkout Repository
121143
uses: actions/checkout@v2
122144
- name: Fetch Cached Artifacts
123-
uses: actions/cache@v2.1.6
145+
uses: actions/cache@v2
124146
with:
125147
path: ${{ github.workspace }}/build/_output/bin/nginx-ingress-operator
126148
key: nginx-ingress-operator-${{ github.run_id }}-${{ github.run_number }}
@@ -136,15 +158,13 @@ jobs:
136158
with:
137159
file: Dockerfile
138160
context: '.'
139-
# Disable cache until https://github.com/docker/buildx/issues/681 is fixed
140-
# cache-from: type=gha
141-
# cache-to: type=gha,mode=max
142161
cache-from: type=gha
143162
cache-to: type=gha,mode=max
144163
tags: |
145164
nginx/nginx-ingress-operator:latest
146165
nginx/nginx-ingress-operator:${{ needs.vars.outputs.git_tag }}
147166
push: true
167+
pull: true
148168

149169
notify:
150170
name: Notify

0 commit comments

Comments
 (0)