-
Notifications
You must be signed in to change notification settings - Fork 276
116 lines (112 loc) · 4.13 KB
/
trivy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Trivy scanner
on:
workflow_dispatch:
push:
branches: [ master, 'release-**' ]
paths:
- '.github/workflows/trivy.yaml'
- 'pkg/**.go'
- '!kubetest2-aks/**.go'
- 'cmd/**.go'
- 'go.*'
- '!vendor/**'
- 'health-probe-proxy/**'
pull_request:
branches: [ master, 'release-**' ]
paths:
- '.github/workflows/trivy.yaml'
- 'pkg/**.go'
- '!kubetest2-aks/**.go'
- 'cmd/**.go'
- 'go.*'
- '!vendor/**'
- 'health-probe-proxy/**'
schedule:
- cron: '0 1 * * *'
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for sbom
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
name: Build
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go 1.x
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: '>=1.20'
check-latest: true
id: go
- name: Build images
run: |
export TAG=${{ github.sha }}
export IMAGE_TAG=${{ github.sha }}
make build-ccm-image
make build-node-image-linux-amd64
cd health-probe-proxy && make build-health-probe-proxy-image && cd ..
- name: Run Trivy scanner CCM
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # master
with:
image-ref: 'local/azure-cloud-controller-manager:${{ github.sha }}'
format: 'sarif'
output: 'trivy-ccm-results.sarif'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
env:
TRIVY_SKIP_DB_UPDATE: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
sarif_file: 'trivy-ccm-results.sarif'
category: azure-cloud-controller-manager-image
- name: Run Trivy scanner CNM
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # master
with:
image-ref: 'local/azure-cloud-node-manager:${{ github.sha }}-linux-amd64'
format: 'sarif'
output: 'trivy-cnm-linux-results.sarif'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
env:
TRIVY_SKIP_DB_UPDATE: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
sarif_file: 'trivy-cnm-linux-results.sarif'
category: azure-cloud-node-manager-linux-image
- name: Run Trivy scanner health-probe-proxy
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # master
with:
image-ref: 'local/health-probe-proxy:${{ github.sha }}'
format: 'sarif'
output: 'trivy-health-probe-proxy-linux-results.sarif'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
env:
TRIVY_SKIP_DB_UPDATE: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
sarif_file: 'trivy-health-probe-proxy-linux-results.sarif'
category: health-probe-proxy-linux-image
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # master
with:
scan-type: 'fs'
format: 'github'
output: 'dependency-results.sbom.json'
scan-ref: '.'
github-pat: ${{ secrets.GITHUB_TOKEN }}
env:
TRIVY_SKIP_DB_UPDATE: true