-
Notifications
You must be signed in to change notification settings - Fork 4
289 lines (262 loc) · 9.38 KB
/
ci.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
---
# test-build-release is the main workflow which will trigger
# linters, tests, and builds for the project for all events.
# It will also trigger the release workflows when a tag is created
# or when a push is made to the main branch.
name: test-build-release
on:
pull_request:
branches:
- main
- release-*
push:
branches:
- main
- release-*
tags:
- 'v*.*.*'
jobs:
# Pre jobs: Linter
linters:
uses: ./.github/workflows/pre_linters.yaml
# Pre jobs: unit tests and integration tests
test-openshift-tests-plugin:
uses: ./.github/workflows/pre_test-openshift-tests-plugin.yaml
# build-container-amd64: triggered when a PR is made
build-container-amd64:
runs-on: ubuntu-latest
needs:
- linters
- test-openshift-tests-plugin
env:
VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
VERSION_TOOLS: v0.4.0
PLATFORMS: linux/amd64
EXPIRATION: 1d
PUSH: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Skip login step when the PR is from external repo, where
# Secrets isnt exported.
- name: Login to Docker Hub
if: github.event.pull_request.head.repo.full_name == github.repository
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}
- name: "Build and push: plugin-openshift-tests"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
BUILD_VERSION=${{ env.VERSION }}
tags: "localhost/plugin-openshift-tests:latest"
outputs: |
type=image,name=localhost/plugin-openshift-tests:latest,push=false
load: true
context: ./openshift-tests-plugin
file: ./openshift-tests-plugin/Containerfile
- name: show images
run: docker images
# disable while not able to access the images previously built.
# Is it possible with cache-from/to?
# - name: "Build and push: plugin-artifacts-collector"
# uses: docker/build-push-action@v6
# with:
# platforms: ${{ env.PLATFORMS }}
# push: ${{ env.PUSH }}
# labels: |
# quay.expires-after=${{ env.EXPIRATION }}
# build-args: |
# QUAY_EXPIRATION=${{ env.EXPIRATION }}
# TOOLS_VERSION=${{ env.VERSION_TOOLS }}
# tags: quay.io/opct/plugin-artifacts-collector:${{ env.VERSION }}
# context: ./artifacts-collector
# file: ./artifacts-collector/Containerfile
- name: "Build and push: must-gather-monitoring"
uses: docker/build-push-action@v6
env:
PLUGIN_IMAGE_OVERRIDE: "localhost/plugin-openshift-tests:latest"
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile
#
# Releasing latest: triggered when push to main
#
release-latest:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build-container-amd64]
env:
VERSION: "latest"
PLATFORMS: linux/amd64,linux/arm64
EXPIRATION: never
PUSH: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}
- name: "Build and push: plugin-openshift-tests"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
BUILD_VERSION=${{ env.VERSION }}
tags: quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}
context: ./openshift-tests-plugin
file: ./openshift-tests-plugin/Containerfile
- name: "Build and push: plugin-artifacts-collector"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
TOOLS_VERSION=${{ env.VERSION_TOOLS }}
tags: quay.io/opct/plugin-artifacts-collector:${{ env.VERSION }}
context: ./artifacts-collector
file: ./artifacts-collector/Containerfile
- name: "Build and push: must-gather-monitoring"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile
#
# Releasing tag: triggered when a tag is created
#
release-tag:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build-container-amd64]
env:
PLATFORMS: linux/amd64,linux/arm64
EXPIRATION: never
PUSH: true
PLUGIN_REPO: quay.io/opct/plugin-openshift-tests
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set vars
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}
- name: "Build and push: plugin-openshift-tests"
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
BUILD_VERSION=${{ env.VERSION }}
tags: ${{ env.PLUGIN_REPO }}:${{ env.VERSION }}
context: ./openshift-tests-plugin
file: ./openshift-tests-plugin/Containerfile
- name: "Build and push: plugin-artifacts-collector"
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |-
quay.expires-after=${{ env.EXPIRATION }}
build-args: |-
BUILD_VERSION=${{ env.VERSION }}
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/plugin-artifacts-collector:${{ env.VERSION }}
context: ./artifacts-collector
file: ./artifacts-collector/Containerfile
- name: "Build and push: must-gather-monitoring"
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile
# https://github.com/mikepenz/release-changelog-builder-action#configuration
- name: Build Changelog
id: github_release
uses: mikepenz/[email protected]
with:
configuration: ".github/workflows/changelog-configuration.json"
# https://github.com/softprops/action-gh-release
- name: Create Release on Github
uses: softprops/[email protected]
env:
VERSION: ${{ steps.vars.outputs.tag }}
REPO: quay.io/opct/plugin-openshift-tests
URL: https://quay.io/repository/opct/plugin-openshift-tests?tab=tags
with:
body: |
## Changelog
Image published to [${REPO}:${VERSION}](${URL})
${{steps.github_release.outputs.changelog}}