-
Notifications
You must be signed in to change notification settings - Fork 2
175 lines (168 loc) · 6.85 KB
/
scan.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: scan
on:
workflow_dispatch:
schedule:
- cron: '00 3 * * 1-5' # every weekday at 3am UTC
permissions:
contents: read
env:
REGISTRY: docker.io
jobs:
get-image-version:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
sc: ${{ steps.version.outputs.sc }}
kc: ${{ steps.version.outputs.kc }}
hc: ${{ steps.version.outputs.hc }}
nc: ${{ steps.version.outputs.nc }}
irc: ${{ steps.version.outputs.irc }}
iac: ${{ steps.version.outputs.iac }}
flux2: ${{ steps.version.outputs.flux2 }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get image version
id: version
run: |
LATEST=$(curl -fsSL -H "Authorization: token ${{ secrets.WEAVE_ASSURED_GHCR_BOT_TOKEN }}" https://api.github.com/repos/weaveworks/weave-assured-flux/releases/latest | grep tag_name | cut -d '"' -f 4)
if [[ -z "$LATEST" ]]; then
echo "Unable to determine Weave Assured Flux version"
exit 1
fi
oras pull ghcr.io/weaveworks/flux-images-digests:$LATEST
source ./ghcr.io/flux-system/image_digests
echo "sc=${SOURCE_CONTROLLER_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
echo "kc=${KUSTOMIZE_CONTROLLER_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
echo "hc=${HELM_CONTROLLER_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
echo "nc=${NOTIFICATION_CONTROLLER_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
echo "irc=${IMAGE_REFLECTOR_CONTROLLER_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
echo "iac=${IMAGE_AUTOMATION_CONTROLLER_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
echo "flux2=${FLUX_CLI_IMAGE_DIGEST}" >> $GITHUB_OUTPUT
scan-trivy:
runs-on: ubuntu-latest
needs: get-image-version
steps:
- name: Scan source-controller image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/source-controller@${{ needs.get-image-version.outputs.sc }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan kustomize-controller image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/kustomize-controller@${{ needs.get-image-version.outputs.kc }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan helm-controller image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/helm-controller@${{ needs.get-image-version.outputs.hc }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan notification-controller image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/notification-controller@${{ needs.get-image-version.outputs.nc }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan image-reflector-controller image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/image-reflector-controller@${{ needs.get-image-version.outputs.irc }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan image-automation-controller image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/image-automation-controller@${{ needs.get-image-version.outputs.iac }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Scan flux2 image Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/weaveworks/flux-cli@${{ needs.get-image-version.outputs.flux2 }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
scan-docker-scout:
runs-on: ubuntu-latest
needs: get-image-version
steps:
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Scan source-controller image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/source-controller@${{ needs.get-image-version.outputs.sc }}'
only-severities: critical,high
exit-code: true
- name: Scan kustomize-controller image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/kustomize-controller@${{ needs.get-image-version.outputs.kc }}'
only-severities: critical,high
exit-code: true
- name: Scan helm-controller image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/helm-controller@${{ needs.get-image-version.outputs.hc }}'
only-severities: critical,high
exit-code: true
- name: Scan notification-controller image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/notification-controller@${{ needs.get-image-version.outputs.nc }}'
only-severities: critical,high
exit-code: true
- name: Scan image-reflector-controller image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/image-reflector-controller@${{ needs.get-image-version.outputs.irc }}'
only-severities: critical,high
exit-code: true
- name: Scan image-automation-controller image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/image-automation-controller@${{ needs.get-image-version.outputs.iac }}'
only-severities: critical,high
exit-code: true
- name: Scan flux2 image
uses: docker/scout-action@b7413c99043c2a9131c0fa39cedaece80f285788 # v1.2.2
with:
command: cves
image: 'ghcr.io/weaveworks/flux-cli@${{ needs.get-image-version.outputs.flux2 }}'
only-severities: critical,high
exit-code: true