-
Notifications
You must be signed in to change notification settings - Fork 12
305 lines (255 loc) · 8.3 KB
/
build.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
name: Build
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
pre-build-updater:
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies
- name: Build updater
run: make build-updater
- name: Bundle the build to preserve permissions
run: tar -cvzf updater-build.tgz bin/updater
- uses: actions/upload-artifact@v3
with:
name: updater-build
path: updater-build.tgz
pre-build-scanner:
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies
- name: Build Scanner
run: make scanner-build-nodeps
- name: Bundle the build to preserve permissions
run: tar -cvzf scanner-build.tgz image/scanner/bin/scanner
- uses: actions/upload-artifact@v3
with:
name: scanner-build
path: scanner-build.tgz
generate-genesis-dump:
runs-on: ubuntu-latest
needs:
- pre-build-updater
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- uses: actions/download-artifact@v3
with:
name: updater-build
- name: Unpack updater build
run: |
tar xvzf updater-build.tgz
- name: genesis-dump
run: |
source ./scripts/ci/lib.sh
generate_genesis_dump
- uses: actions/upload-artifact@v3
with:
name: genesis-dump
path: /tmp/genesis-dump/genesis-dump.zip
- uses: actions/upload-artifact@v3
with:
name: vuln-dump
path: /tmp/vuln-dump
generate-db-dump:
runs-on: ubuntu-latest
needs:
- generate-genesis-dump
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- uses: actions/download-artifact@v3
with:
name: updater-build
- name: Unpack updater build
run: |
tar xvzf updater-build.tgz
- uses: actions/download-artifact@v3
with:
name: genesis-dump
path: /tmp/genesis-dump
- name: db-dump
run: |
source ./scripts/ci/lib.sh
generate_db_dump
- uses: actions/upload-artifact@v3
with:
name: db-dump
path: /tmp/postgres/pg-definitions.sql.gz
generate-scanner-bundle:
runs-on: ubuntu-latest
needs:
- generate-genesis-dump
- pre-build-scanner
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- uses: actions/download-artifact@v3
with:
name: scanner-build
- name: Unpack scanner build
run: |
tar xvzf scanner-build.tgz
- uses: actions/download-artifact@v3
with:
name: vuln-dump
path: /tmp/vuln-dump
- name: Generate OSS notice
run: make ossls-notice
- name: Get genesis dump
run: |
source ./scripts/ci/lib.sh
get_genesis_dump
- name: Make bundle
run: image/scanner/rhel/create-bundle.sh image/scanner image/scanner/rhel
- uses: actions/upload-artifact@v3
with:
name: scanner-bundle
path: image/scanner/rhel/bundle.tar.gz
generate-scanner-db-bundle:
runs-on: ubuntu-latest
needs:
- generate-db-dump
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- uses: actions/download-artifact@v3
with:
name: db-dump
path: /tmp/postgres/pg-definitions.sql.gz
- name: Get db dump
run: |
source ./scripts/ci/lib.sh
get_db_dump
- name: Make db bundle
run: image/db/rhel/create-bundle.sh image/db image/db/rhel
- uses: actions/upload-artifact@v3
with:
name: scanner-db-bundle
path: image/db/rhel/bundle.tar.gz
# build-and-push-main:
build-images:
runs-on: ubuntu-latest
needs:
- generate-scanner-bundle
- generate-scanner-db-bundle
container:
image: quay.io/stackrox-io/apollo-ci:scanner-test-0.3.61
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
- uses: actions/download-artifact@v3
with:
name: scanner-bundle
path: image/scanner/rhel
- uses: actions/download-artifact@v3
with:
name: scanner-db-bundle
path: image/db/rhel
- name: Build scanner image
run: |
docker build -t scanner:"$(make --quiet tag)" -f image/scanner/rhel/Dockerfile image/scanner/rhel
- name: Build scanner-slim image
run: |
docker build -t scanner-slim:"$(make --quiet tag)" -f image/scanner/rhel/Dockerfile.slim image/scanner/rhel
- name: Build scanner-db image
run: |
docker build -t scanner-db:"$(make --quiet tag)" -f image/db/rhel/Dockerfile image/db/rhel
- name: Build scanner-db-slim image
run: |
docker build -t scanner-db-slim:"$(make --quiet tag)" -f image/db/rhel/Dockerfile.slim image/db/rhel
# # needed for docs ensure_image.sh initial pull with RHACS_BRANDING
# - name: Docker login
# # Skip for external contributions.
# if: |
# github.event_name == 'push' || !github.event.pull_request.head.repo.fork
# run: |
# docker login -u "${QUAY_RHACS_ENG_RO_USERNAME}" --password-stdin quay.io <<<"${QUAY_RHACS_ENG_RO_PASSWORD}"
#
# - name: Push images
# # Skip for external contributions.
# if: |
# github.event_name == 'push' || !github.event.pull_request.head.repo.fork
# run: |
# source ./scripts/ci/lib.sh
# echo "Will determine context from: ${{ github.event_name }} & ${{ github.ref_name }}"
# push_context=""
# if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_name }}" == "master" ]]; then
# push_context="merge-to-master"
# fi
# push_main_image_set "$push_context" "${{ env.ROX_PRODUCT_BRANDING }}" "${{ matrix.arch }}"
#
# - name: Push matching collector and scanner images
# # Skip for external contributions.
# if: |
# github.event_name == 'push' || !github.event.pull_request.head.repo.fork
# run: |
# # Need to free up some space before push_matching_collector_scanner_images() does its pull.
# docker system prune --all --force
# source ./scripts/ci/lib.sh
# push_matching_collector_scanner_images "${{ env.ROX_PRODUCT_BRANDING }}" "${{ matrix.arch }}"
#
# - name: diff-dumps
# run: |
# ./scripts/ci/jobs/diff-dumps.sh
#
# - name: diff-dumps
# run: |
# ./scripts/ci/jobs/diff-dumps.sh
#
# - name: store-db-dump
# run: |
# ./scripts/ci/jobs/store-db-dump.sh