9
9
- trying
10
10
- " renovate/**"
11
11
tags :
12
- - " * "
12
+ - ' [0-9][0-9].[0-9]+.[0-9]+ '
13
13
pull_request :
14
14
15
15
env :
19
19
RUSTFLAGS : " -D warnings"
20
20
RUSTDOCFLAGS : " -D warnings"
21
21
RUST_LOG : " info"
22
- OPERATOR_NAME : " spark-k8s-operator"
23
- PRODUCT_NAME : " spark-k8s"
24
22
DEV_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-dev
25
23
TEST_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-test
26
24
STABLE_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-stable
25
+ # TODO remove before final go-live!
26
+ EXP_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-experimental
27
27
28
28
jobs :
29
29
# Identify unused dependencies
43
43
- uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
44
44
with :
45
45
profile : minimal
46
- toolchain : " 1.63 .0"
46
+ toolchain : " 1.65 .0"
47
47
override : true
48
48
- uses : Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
49
49
with :
@@ -56,68 +56,49 @@ jobs:
56
56
with :
57
57
command : udeps
58
58
59
- prerelease_job :
60
- name : Returns the pre-release string from the version of the cargo workspace.
61
- runs-on : ubuntu-latest
62
- outputs :
63
- str : ${{ steps.prerelease.outputs.str }}
64
- steps :
65
- - uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
66
- with :
67
- submodules : recursive
68
- - uses : actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4
69
- - name : Install requirements for version tool
70
- run : pip install -r python/requirements.txt
71
- - id : prerelease
72
- name : Extract the pre-release string. Might be empty.
73
- run : |
74
- PRERELEASE=$(python/cargo_version.py -o | sed "s/^[0-9]\+\.[0-9]\+\.[0-9]\+-\?//g")
75
- echo "::set-output name=str::$PRERELEASE"
76
-
77
59
# This job evaluates the github environment to determine why this action is running and selects the appropriate
78
60
# target repository for published Helm charts based on this.
79
61
#
80
62
# The following scenarios are identified:
81
- # - pull request :
63
+ # - all pull requests land in the test repository :
82
64
# condition: github.event_name == "pull_request"
83
65
# repository: test
84
66
#
85
- # - release (aka a tag was created) :
67
+ # - all tagged releases land in stable :
86
68
# condition: github.event_name == 'create' & github.ref.startswith('refs/tags/')
87
69
# repository: stable
88
70
#
89
- # - merge of pr to main branch and pre release is nightly :
90
- # condition: github.event_name == 'push' & github.ref == 'refs/heads/main' & needs.prerelease_job.outputs.str == 'nightly'
71
+ # - all pushes to main (i.e. PR-merges) land in dev :
72
+ # condition: github.event_name == 'push' & github.ref == 'refs/heads/main'
91
73
# repository: dev
92
74
#
93
- # Any other scenarios will cause the publish step to be skipped, most commonly this is expected to happen for the
75
+ # Any other scenarios (e.g. when a branch is created/pushed) will cause the publish step to be skipped, most commonly this is expected to happen for the
94
76
# branches that bors uses internally (staging, trying) for which the checks need to run, but we do not want artifacts
95
77
# to be published.
96
- select_repo :
97
- name : Select target repository based on action trigger
78
+ select_helm_repo :
79
+ name : Select target helm repository based on action trigger
98
80
runs-on : ubuntu-latest
99
81
outputs :
100
- repository : ${{ steps.selectrepo.outputs.repo }}
101
- needs : prerelease_job
82
+ helm_repository : ${{ steps.selecthelmrepo.outputs.helm_repo }}
102
83
steps :
103
- - id : selectrepo
84
+ - id : selecthelmrepo
104
85
env :
105
86
TRIGGER : ${{ github.event_name }}
106
87
GITHUB_REF : ${{ github.ref }}
107
- PRERELEASE : ${{ needs.prerelease_job.outputs.str }}
108
88
run : |
109
89
if [[ $TRIGGER == "pull_request" ]]; then
110
- echo "exporting test as target repo: ${{ env.TEST_REPO_HELM_URL }}"
111
- echo "::set-output name=repo ::${{ env.TEST_REPO_HELM_URL }}"
112
- elif [[ $TRIGGER == "push" && $GITHUB_REF == "refs/heads/main" && $PRERELEASE == 'nightly' ]]; then
113
- echo "exporting dev as target repo: ${{ env.DEV_REPO_HELM_URL }}"
114
- echo "::set-output name=repo ::${{ env.DEV_REPO_HELM_URL }}"
90
+ echo "exporting test as target helm repo: ${{ env.TEST_REPO_HELM_URL }}"
91
+ echo "::set-output name=helm_repo ::${{ env.TEST_REPO_HELM_URL }}"
92
+ elif [[ $TRIGGER == "push" && $GITHUB_REF == "refs/heads/main" ]]; then
93
+ echo "exporting dev as target helm repo: ${{ env.DEV_REPO_HELM_URL }}"
94
+ echo "::set-output name=helm_repo ::${{ env.DEV_REPO_HELM_URL }}"
115
95
elif [[ ( $TRIGGER == "create" || $TRIGGER == "push" ) && $GITHUB_REF == refs/tags/* ]]; then
116
- echo "exporting stable as target repo: ${{ env.STABLE_REPO_HELM_URL }}"
117
- echo "::set-output name=repo::${{ env.STABLE_REPO_HELM_URL }}"
96
+ # TODO replace EXP with STABLE repo name
97
+ echo "exporting stable as target helm repo: ${{ env.EXP_REPO_HELM_URL }}"
98
+ echo "::set-output name=helm_repo::${{ env.EXP_REPO_HELM_URL }}"
118
99
else
119
100
echo "Unknown trigger and ref combination encountered, skipping publish step: $TRIGGER $GITHUB_REF"
120
- echo "::set-output name=repo ::skip"
101
+ echo "::set-output name=helm_repo ::skip"
121
102
fi
122
103
123
104
run_cargodeny :
@@ -150,7 +131,7 @@ jobs:
150
131
- uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
151
132
with :
152
133
profile : minimal
153
- toolchain : " 1.63 .0"
134
+ toolchain : " 1.65 .0"
154
135
components : rustfmt
155
136
override : true
156
137
- uses : actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
@@ -172,7 +153,7 @@ jobs:
172
153
- uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
173
154
with :
174
155
profile : minimal
175
- toolchain : " 1.63 .0"
156
+ toolchain : " 1.65 .0"
176
157
components : clippy
177
158
override : true
178
159
- uses : Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
@@ -206,7 +187,7 @@ jobs:
206
187
- uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
207
188
with :
208
189
profile : minimal
209
- toolchain : " 1.63 .0"
190
+ toolchain : " 1.65 .0"
210
191
components : rustfmt
211
192
override : true
212
193
- uses : Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
@@ -219,11 +200,6 @@ jobs:
219
200
220
201
run_tests :
221
202
name : Run Cargo Tests
222
- needs :
223
- - run_cargodeny
224
- - run_clippy
225
- - run_rustfmt
226
- - run_rustdoc
227
203
runs-on : ubuntu-latest
228
204
steps :
229
205
- name : Install protoc
@@ -236,7 +212,7 @@ jobs:
236
212
- uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
237
213
with :
238
214
profile : minimal
239
- toolchain : " 1.63 .0"
215
+ toolchain : " 1.65 .0"
240
216
override : true
241
217
- uses : Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
242
218
with :
@@ -272,23 +248,18 @@ jobs:
272
248
script : |
273
249
core.setFailed('Committed README are not up to date, please make sure to apply them to the templated partials, and re-commit!')
274
250
275
- # This job cleans up the CRDs, Helm charts and Kustomize manifests , followed by rebuilding them
251
+ # This job cleans up the CRDs and Helm charts , followed by rebuilding them
276
252
# It then runs a `git diff` and fails the entire workflow, if any difference is encountered.
277
253
#
278
254
# Since CRD files are generated during the 'cargo build' process we need to run this once after
279
255
# removing the CRD files to ensure that the checked in versions match what the code expects.
280
256
#
281
257
# The reason for this step is, that developers are expected to check in up-to-date versions of charts
282
- # and manifests, as we'd otherwise have to build these in CI and commit them back to the PR, which
258
+ # as we'd otherwise have to build these in CI and commit them back to the PR, which
283
259
# creates all kinds of problems.
284
- # Therefor this failsafe simply aborts anything that has not had charts and manifests rebuilt before pushing.
260
+ # This failsafe simply aborts anything that has not had charts rebuilt before pushing.
285
261
check_charts :
286
- name : Check if committed Helm & Kustomize Charts were up to date
287
- needs :
288
- - run_cargodeny
289
- - run_clippy
290
- - run_rustfmt
291
- - run_rustdoc
262
+ name : Check if committed Helm charts are up to date
292
263
runs-on : ubuntu-latest
293
264
steps :
294
265
- name : Install protoc
@@ -307,7 +278,7 @@ jobs:
307
278
uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
308
279
with :
309
280
profile : minimal
310
- toolchain : " 1.63 .0"
281
+ toolchain : " 1.65 .0"
311
282
override : true
312
283
- name : Set up rust-cache
313
284
uses : Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
@@ -324,25 +295,17 @@ jobs:
324
295
script : |
325
296
core.setFailed('Committed charts were not up to date, please regenerate and re-commit!')
326
297
327
- test_charts :
328
- name : Run Chart Tests
329
- needs :
330
- - check_charts
331
- - run_tests
332
- runs-on : ubuntu-latest
333
- steps :
334
- - name : Checkout
335
- uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
336
- with :
337
- submodules : recursive
338
- - name : placeholder
339
- run : echo Tests will go here
340
-
341
298
tests_passed :
342
299
name : All tests passed
343
300
needs :
344
- - test_charts
345
301
- run_udeps
302
+ - run_cargodeny
303
+ - run_clippy
304
+ - run_rustfmt
305
+ - run_rustdoc
306
+ - run_tests
307
+ - check_charts
308
+ - check_readme
346
309
runs-on : ubuntu-latest
347
310
steps :
348
311
- name : log
@@ -352,12 +315,12 @@ jobs:
352
315
name : Package Charts, Build Docker Image and publish them
353
316
needs :
354
317
- tests_passed
355
- - select_repo
318
+ - select_helm_repo
356
319
runs-on : ubuntu-latest
357
320
env :
358
321
NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
359
- REPO : ${{ needs.select_repo .outputs.repository }}
360
- if : needs.select_repo .outputs.repository != 'skip'
322
+ HELM_REPO : ${{ needs.select_helm_repo .outputs.helm_repository }}
323
+ if : needs.select_helm_repo .outputs.helm_repository != 'skip'
361
324
steps :
362
325
- name : Install protoc
363
326
run : |
@@ -372,7 +335,7 @@ jobs:
372
335
- uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
373
336
with :
374
337
profile : minimal
375
- toolchain : " 1.63 .0"
338
+ toolchain : " 1.65 .0"
376
339
components : rustfmt
377
340
override : true
378
341
- name : Install requirements for version tool
@@ -386,22 +349,8 @@ jobs:
386
349
if : ${{ github.event_name == 'pull_request' }}
387
350
run : python/cargo_version.py -m pr${{ github.event.pull_request.number }}
388
351
389
- # Recreate charts with changed version if needed
390
- - name : Clean charts
391
- if : ${{ github.event_name == 'pull_request' }}
392
- run : make chart-clean clean-manifests compile-chart generate-manifests
393
-
394
- # Package and publish charts
395
- - name : Package Chart
396
- run : mkdir -p target/helm && helm package --destination target/helm deploy/helm/${{ env.OPERATOR_NAME }}
397
- - name : Build Docker image
398
- if : env.NEXUS_PASSWORD != null # pragma: allowlist secret
399
- run : make docker
400
- - name : Publish Chart
401
- if : env.NEXUS_PASSWORD != null # pragma: allowlist secret
402
- run : >-
403
- /usr/bin/curl
404
- --fail
405
- -u 'github:${{ secrets.NEXUS_PASSWORD }}'
406
- --upload-file "./$(find target/helm/ -name '*.tgz')"
407
- "${{ env.REPO }}/"
352
+ # Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
353
+ # default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
354
+ # This is needed for the HELM_REPO variable.
355
+ - name : Publish Docker image and Helm chart
356
+ run : make -e publish
0 commit comments