@@ -14,7 +14,8 @@ concurrency:
14
14
env :
15
15
SEMVER_PATTERN : ' ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-rc\.([0-9]+))?$'
16
16
IMAGE_REGISTRY : ghcr.io
17
- IMAGE_REPOSITORY : kubeflow/spark-operator/controller
17
+ OPERATOR_IMAGE_REPOSITORY : kubeflow/spark-operator/controller
18
+ KUBECTL_IMAGE_REPOSITORY : kubeflow/spark-operator/kubectl
18
19
19
20
jobs :
20
21
check-release :
65
66
echo "Tag '${VERSION}' does not exist."
66
67
fi
67
68
68
- build_images :
69
+ build_operator_images :
69
70
needs :
70
71
- check-release
71
72
96
97
id : meta
97
98
uses : docker/metadata-action@v5
98
99
with :
99
- images : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}
100
+ images : ${{ env.IMAGE_REGISTRY }}/${{ env.OPERATOR_IMAGE_REPOSITORY }}
100
101
tags : |
101
102
type=semver,pattern={{version}},value=${{ env.VERSION }}
102
103
@@ -119,7 +120,7 @@ jobs:
119
120
with :
120
121
platforms : ${{ matrix.platform }}
121
122
labels : ${{ steps.meta.outputs.labels }}
122
- outputs : type=image,name=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }},push-by-digest=true,name-canonical=true,push=true
123
+ outputs : type=image,name=${{ env.IMAGE_REGISTRY }}/${{ env.OPERATOR_IMAGE_REPOSITORY }},push-by-digest=true,name-canonical=true,push=true
123
124
124
125
- name : Export digest
125
126
run : |
@@ -130,14 +131,85 @@ jobs:
130
131
- name : Upload digest
131
132
uses : actions/upload-artifact@v4
132
133
with :
133
- name : digests-${{ env.PLATFORM_PAIR }}
134
+ name : digests-operator- ${{ env.PLATFORM_PAIR }}
134
135
path : /tmp/digests/*
135
136
if-no-files-found : error
136
137
retention-days : 1
137
138
138
- release_images :
139
+ build_kubectl_images :
139
140
needs :
140
- - build_images
141
+ - check-release
142
+
143
+ runs-on : ubuntu-latest
144
+
145
+ strategy :
146
+ fail-fast : false
147
+ matrix :
148
+ platform :
149
+ - linux/amd64
150
+ - linux/arm64
151
+
152
+ steps :
153
+ - name : Prepare
154
+ run : |
155
+ platform=${{ matrix.platform }}
156
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
157
+
158
+ - name : Checkout source code
159
+ uses : actions/checkout@v4
160
+
161
+ - name : Read version from VERSION file
162
+ run : |
163
+ VERSION=$(cat VERSION)
164
+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
165
+
166
+ - name : Docker meta
167
+ id : meta
168
+ uses : docker/metadata-action@v5
169
+ with :
170
+ images : ${{ env.IMAGE_REGISTRY }}/${{ env.KUBECTL_IMAGE_REPOSITORY }}
171
+ tags : |
172
+ type=semver,pattern={{version}},value=${{ env.VERSION }}
173
+
174
+ - name : Set up QEMU
175
+ uses : docker/setup-qemu-action@v3
176
+
177
+ - name : Set up Docker buildx
178
+ uses : docker/setup-buildx-action@v3
179
+
180
+ - name : Login to container registry
181
+ uses : docker/login-action@v3
182
+ with :
183
+ registry : ${{ env.IMAGE_REGISTRY }}
184
+ username : ${{ github.actor }}
185
+ password : ${{ secrets.GITHUB_TOKEN }}
186
+
187
+ - name : Build and push by digest
188
+ id : build
189
+ uses : docker/build-push-action@v6
190
+ with :
191
+ file : docker/Dockerfile.kubectl
192
+ platforms : ${{ matrix.platform }}
193
+ labels : ${{ steps.meta.outputs.labels }}
194
+ outputs : type=image,name=${{ env.IMAGE_REGISTRY }}/${{ env.KUBECTL_IMAGE_REPOSITORY }},push-by-digest=true,name-canonical=true,push=true
195
+
196
+ - name : Export digest
197
+ run : |
198
+ mkdir -p /tmp/digests
199
+ digest="${{ steps.build.outputs.digest }}"
200
+ touch "/tmp/digests/${digest#sha256:}"
201
+
202
+ - name : Upload digest
203
+ uses : actions/upload-artifact@v4
204
+ with :
205
+ name : digests-kubectl-${{ env.PLATFORM_PAIR }}
206
+ path : /tmp/digests/*
207
+ if-no-files-found : error
208
+ retention-days : 1
209
+
210
+ release_operator_images :
211
+ needs :
212
+ - build_operator_images
141
213
142
214
runs-on : ubuntu-latest
143
215
@@ -154,7 +226,7 @@ jobs:
154
226
id : meta
155
227
uses : docker/metadata-action@v5
156
228
with :
157
- images : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}
229
+ images : ${{ env.IMAGE_REGISTRY }}/${{ env.OPERATOR_IMAGE_REPOSITORY }}
158
230
tags : |
159
231
type=semver,pattern={{version}},value=${{ env.VERSION }}
160
232
@@ -179,15 +251,66 @@ jobs:
179
251
working-directory : /tmp/digests
180
252
run : |
181
253
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
182
- $(printf '${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}@sha256:%s ' *)
254
+ $(printf '${{ env.IMAGE_REGISTRY }}/${{ env.OPERATOR_IMAGE_REPOSITORY }}@sha256:%s ' *)
255
+
256
+ - name : Inspect image
257
+ run : |
258
+ docker buildx imagetools inspect ${{ env.IMAGE_REGISTRY }}/${{ env.OPERATOR_IMAGE_REPOSITORY }}:${{ steps.meta.outputs.version }}
259
+
260
+ release_kubectl_images :
261
+ needs :
262
+ - build_kubectl_images
263
+
264
+ runs-on : ubuntu-latest
265
+
266
+ steps :
267
+ - name : Checkout source code
268
+ uses : actions/checkout@v4
269
+
270
+ - name : Read version from VERSION file
271
+ run : |
272
+ VERSION=$(cat VERSION)
273
+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
274
+
275
+ - name : Docker meta
276
+ id : meta
277
+ uses : docker/metadata-action@v5
278
+ with :
279
+ images : ${{ env.IMAGE_REGISTRY }}/${{ env.KUBECTL_IMAGE_REPOSITORY }}
280
+ tags : |
281
+ type=semver,pattern={{version}},value=${{ env.VERSION }}
282
+
283
+ - name : Download digests
284
+ uses : actions/download-artifact@v4
285
+ with :
286
+ path : /tmp/digests
287
+ pattern : digests-kubectl-*
288
+ merge-multiple : true
289
+
290
+ - name : Set up Docker buildx
291
+ uses : docker/setup-buildx-action@v3
292
+
293
+ - name : Login to container registry
294
+ uses : docker/login-action@v3
295
+ with :
296
+ registry : ${{ env.IMAGE_REGISTRY }}
297
+ username : ${{ github.actor }}
298
+ password : ${{ secrets.GITHUB_TOKEN }}
299
+
300
+ - name : Create manifest list and push
301
+ working-directory : /tmp/digests
302
+ run : |
303
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
304
+ $(printf '${{ env.IMAGE_REGISTRY }}/${{ env.KUBECTL_IMAGE_REPOSITORY }}@sha256:%s ' *)
183
305
184
306
- name : Inspect image
185
307
run : |
186
- docker buildx imagetools inspect ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.meta.outputs.version }}
308
+ docker buildx imagetools inspect ${{ env.IMAGE_REGISTRY }}/${{ env.KUBECTL_IMAGE_REPOSITORY }}:${{ steps.meta.outputs.version }}
187
309
188
310
push_tag :
189
311
needs :
190
- - release_images
312
+ - release_operator_images
313
+ - release_kubectl_images
191
314
192
315
runs-on : ubuntu-latest
193
316
@@ -209,7 +332,7 @@ jobs:
209
332
210
333
- name : Create and push tag
211
334
run : |
212
- git tag -a "${VERSION}" -m "Spark Operator Official Release ${VERSION}"
335
+ git tag -a "${VERSION}" -m "Official Release ${VERSION}"
213
336
git push origin "${VERSION}"
214
337
215
338
draft_release :
@@ -251,7 +374,7 @@ jobs:
251
374
uses : softprops/action-gh-release@v2
252
375
with :
253
376
token : ${{ secrets.GITHUB_TOKEN }}
254
- name : " Spark Operator ${{ env.VERSION }}"
377
+ name : ${{ env.VERSION }}
255
378
tag_name : ${{ env.VERSION }}
256
379
prerelease : ${{ contains(env.VERSION, 'rc') }}
257
380
target_commitish : ${{ github.sha }}
0 commit comments