99 - trying
1010 - " renovate/**"
1111 tags :
12- - " * "
12+ - ' [0-9][0-9].[0-9]+.[0-9]+ '
1313 pull_request :
1414
1515env :
1919 RUSTFLAGS : " -D warnings"
2020 RUSTDOCFLAGS : " -D warnings"
2121 RUST_LOG : " info"
22- OPERATOR_NAME : " trino-operator"
23- PRODUCT_NAME : " trino"
2422 DEV_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-dev
2523 TEST_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-test
2624 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
2727
2828jobs :
2929 # Identify unused dependencies
@@ -56,68 +56,49 @@ jobs:
5656 with :
5757 command : udeps
5858
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-
7759 # This job evaluates the github environment to determine why this action is running and selects the appropriate
7860 # target repository for published Helm charts based on this.
7961 #
8062 # The following scenarios are identified:
81- # - pull request :
63+ # - all pull requests land in the test repository :
8264 # condition: github.event_name == "pull_request"
8365 # repository: test
8466 #
85- # - release (aka a tag was created) :
67+ # - all tagged releases land in stable :
8668 # condition: github.event_name == 'create' & github.ref.startswith('refs/tags/')
8769 # repository: stable
8870 #
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'
9173 # repository: dev
9274 #
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
9476 # branches that bors uses internally (staging, trying) for which the checks need to run, but we do not want artifacts
9577 # 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
9880 runs-on : ubuntu-latest
9981 outputs :
100- repository : ${{ steps.selectrepo.outputs.repo }}
101- needs : prerelease_job
82+ helm_repository : ${{ steps.selecthelmrepo.outputs.helm_repo }}
10283 steps :
103- - id : selectrepo
84+ - id : selecthelmrepo
10485 env :
10586 TRIGGER : ${{ github.event_name }}
10687 GITHUB_REF : ${{ github.ref }}
107- PRERELEASE : ${{ needs.prerelease_job.outputs.str }}
10888 run : |
10989 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 }}"
11595 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 }}"
11899 else
119100 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"
121102 fi
122103
123104 run_cargodeny :
@@ -219,11 +200,6 @@ jobs:
219200
220201 run_tests :
221202 name : Run Cargo Tests
222- needs :
223- - run_cargodeny
224- - run_clippy
225- - run_rustfmt
226- - run_rustdoc
227203 runs-on : ubuntu-latest
228204 steps :
229205 - name : Install protoc
@@ -272,23 +248,18 @@ jobs:
272248 script : |
273249 core.setFailed('Committed README are not up to date, please make sure to apply them to the templated partials, and re-commit!')
274250
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
276252 # It then runs a `git diff` and fails the entire workflow, if any difference is encountered.
277253 #
278254 # Since CRD files are generated during the 'cargo build' process we need to run this once after
279255 # removing the CRD files to ensure that the checked in versions match what the code expects.
280256 #
281257 # 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
283259 # 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.
285261 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
292263 runs-on : ubuntu-latest
293264 steps :
294265 - name : Install protoc
@@ -324,25 +295,17 @@ jobs:
324295 script : |
325296 core.setFailed('Committed charts were not up to date, please regenerate and re-commit!')
326297
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-
341298 tests_passed :
342299 name : All tests passed
343300 needs :
344- - test_charts
345301 - run_udeps
302+ - run_cargodeny
303+ - run_clippy
304+ - run_rustfmt
305+ - run_rustdoc
306+ - run_tests
307+ - check_charts
308+ - check_readme
346309 runs-on : ubuntu-latest
347310 steps :
348311 - name : log
@@ -352,12 +315,12 @@ jobs:
352315 name : Package Charts, Build Docker Image and publish them
353316 needs :
354317 - tests_passed
355- - select_repo
318+ - select_helm_repo
356319 runs-on : ubuntu-latest
357320 env :
358321 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'
361324 steps :
362325 - name : Install protoc
363326 run : |
@@ -386,22 +349,8 @@ jobs:
386349 if : ${{ github.event_name == 'pull_request' }}
387350 run : python/cargo_version.py -m pr${{ github.event.pull_request.number }}
388351
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