-
Notifications
You must be signed in to change notification settings - Fork 14
368 lines (296 loc) · 11.1 KB
/
Copy pathvalidate-primer.yaml
File metadata and controls
368 lines (296 loc) · 11.1 KB
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
name: Validate Primer
on:
push:
branches: ["main", "release*"]
tags: ["*"]
pull_request:
branches: ["main", "release*"]
env:
GO_VERSION: "1.17"
KIND_VERSION: "0.9.0"
GO111MODULE: "on"
OPERATOR_IMAGE: "quay.io/migtools/gitops-primer"
BUNDLE_IMAGE: "quay.io/migtools/gitops-primer-bundle"
EXPORT_IMAGE: "quay.io/migtools/gitops-primer-export"
DOWNLOADER_IMAGE: "quay.io/migtools/gitops-primer-downloader"
WEBHOOK_IMAGE: "quay.io/migtools/gitops-primer-webhook"
TAG: v0.0.11
jobs:
build-operator:
name: Build-operator
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
- name: Test
run: make test
- name: Build operator container
run: make docker-build IMG=${OPERATOR_IMAGE}
- name: Export container image
run: docker save -o /tmp/operator.tar ${OPERATOR_IMAGE}
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USERNAME}}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push operator image to quay
run: docker push ${OPERATOR_IMAGE}:latest
- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: primer-operator
path: /tmp/operator.tar
build-bundle:
name: Build-Bundle
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
- name: Install operator-sdk
run: |
curl -L -o operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v1.11.0/operator-sdk_linux_amd64
sudo install ./operator-sdk /usr/local/bin && rm operator-sdk
- name: Make bundle
run: make bundle
- name: Build bundle
run: make bundle-build
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USERNAME}}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push bundle image to quay
run: |
docker tag ${BUNDLE_IMAGE}:${TAG} ${BUNDLE_IMAGE}:latest
docker push ${BUNDLE_IMAGE}:latest
- name: Export container image
run: docker save -o /tmp/bundle.tar ${BUNDLE_IMAGE}
- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: primer-bundle
path: /tmp/bundle.tar
build-export:
name: Build-export
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Build export container
run: make -C export image
- name: Export container image
run: docker save -o /tmp/export.tar ${EXPORT_IMAGE}
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USERNAME}}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push export image to quay
run: docker push ${EXPORT_IMAGE}:latest
- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: export-image
path: /tmp/export.tar
build-downloader:
name: Build-downloader
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Build downloader image
run: make -C downloader image
- name: Export container image
run: docker save -o /tmp/downloader.tar ${DOWNLOADER_IMAGE}
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USERNAME}}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push downloader image to quay
run: docker push ${DOWNLOADER_IMAGE}:latest
- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: primer-downloader
path: /tmp/downloader.tar
build-webhook:
name: Build-Webhook
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Build webhook image
run: make -C webhook image
- name: Export container image
run: docker save -o /tmp/webhook.tar ${WEBHOOK_IMAGE}
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USERNAME}}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push webhook image to quay
run: docker push ${WEBHOOK_IMAGE}:latest
- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: primer-webhook
path: /tmp/webhook.tar
push-operator:
name: Push operator container to registry
needs: build-export
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to the registry
run: |
[[ "${OPERATOR_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="quay.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
- name: "Build Operator Image"
uses: docker/build-push-action@v2
with:
context: .
file: "./Dockerfile"
platforms: "linux/amd64,linux/arm64"
push: true
tags: ${{ env.OPERATOR_IMAGE }}:${{ env.TAG }}
push-export:
name: Push export container to registry
needs: [build-webhook, build-operator, build-bundle, build-downloader, build-export]
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to the registry
run: |
[[ "${EXPORT_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="quay.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
- name: "Build Operator Image"
uses: docker/build-push-action@v2
with:
context: "./export"
file: "./export/Dockerfile"
platforms: "linux/amd64,linux/arm64"
push: true
tags: ${{ env.EXPORT_IMAGE }}:${{ env.TAG }}
push-bundle:
name: Push bundle container to registry
needs: [build-webhook, build-operator, build-bundle, build-downloader, build-export]
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to the registry
run: |
[[ "${BUNDLE_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="quay.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
- name: "Build Operator Image"
uses: docker/build-push-action@v2
with:
context: .
file: "./bundle.Dockerfile"
platforms: "linux/amd64,linux/arm64"
push: true
tags: ${{ env.BUNDLE_IMAGE }}:${{ env.TAG }}
push-downloader:
name: Push downloader image to registry
needs: [build-webhook, build-operator, build-bundle, build-downloader, build-export]
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to the registry
run: |
[[ "${DOWNLOADER_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="quay.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
- name: "Build Operator Image"
uses: docker/build-push-action@v2
with:
context: .
file: "./downloader/Dockerfile"
platforms: "linux/amd64,linux/arm64"
push: true
tags: ${{ env.DOWNLOADER_IMAGE }}:${{ env.TAG }}
push-webhook:
name: Push webhook image to registry
needs: [build-webhook, build-operator, build-bundle, build-downloader, build-export]
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: Login to the registry
run: |
[[ "${WEBHOOK_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="quay.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
- name: "Build Operator Image"
uses: docker/build-push-action@v2
with:
context: "./webhook"
file: "./webhook/Dockerfile"
platforms: "linux/amd64,linux/arm64"
push: true
tags: ${{ env.WEBHOOK_IMAGE }}:${{ env.TAG }}