3232 RUSTFLAGS : " -D warnings"
3333 RUSTDOCFLAGS : " -D warnings"
3434 RUST_LOG : " info"
35- DEV_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-dev
36- TEST_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-test
37- STABLE_REPO_HELM_URL : https://repo.stackable.tech/repository/helm-stable
3835
3936jobs :
4037 # Identify unused dependencies
@@ -63,47 +60,41 @@ jobs:
6360 - uses : stackabletech/cargo-install-action@cargo-udeps
6461 - run : cargo udeps --workspace --all-targets
6562
66- # This job evaluates the github environment to determine why this action is running and selects the appropriate
67- # target repository for published Helm charts based on this.
63+ # This job evaluates the github environment to determine why this action is running and decides if
64+ # Helm charts are published based on this.
6865 #
6966 # The following scenarios are identified:
70- # - all pull requests land in the test repository :
67+ # - all pull requests land are published :
7168 # condition: github.event_name == "pull_request"
72- # repository: test
7369 #
74- # - all tagged releases land in stable :
70+ # - all tagged releases are published :
7571 # condition: github.event_name == 'push' & github.ref.startswith('refs/tags/')
76- # repository: stable
7772 #
78- # - all pushes to main (i.e. PR-merges) and all scheduled/manual workflow runs on main land in dev :
73+ # - all pushes to main (i.e. PR-merges) and all scheduled/manual workflow runs on main land are published :
7974 # condition: ( github.event_name == 'push' | github.event_name == 'schedule' | github.event_name == 'workflow_dispatch' ) & github.ref == 'refs/heads/main'
80- # repository: dev
8175 #
8276 # 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
8377 # branches that the GitHub merge queue feature uses internally for which the checks need to run, but we do not want artifacts to be published.
84- select_helm_repo :
85- name : Select target helm repository based on action trigger
78+ check_helm_publish :
79+ name : Decide if Helm charts are pushed to the helm repository based on action trigger
8680 runs-on : ubuntu-latest
8781 outputs :
88- helm_repository : ${{ steps.selecthelmrepo .outputs.helm_repo }}
82+ skip_helm : ${{ steps.checkhelmpublish .outputs.skip_helm }}
8983 steps :
90- - id : selecthelmrepo
84+ - id : checkhelmpublish
9185 env :
9286 TRIGGER : ${{ github.event_name }}
9387 GITHUB_REF : ${{ github.ref }}
9488 run : |
9589 if [[ "$TRIGGER" == "pull_request" ]]; then
96- echo "exporting test as target helm repo: ${{ env.TEST_REPO_HELM_URL }}"
97- echo "helm_repo=${{ env.TEST_REPO_HELM_URL }}" >> "$GITHUB_OUTPUT"
90+ echo "skip_helm=false" >> "$GITHUB_OUTPUT"
9891 elif [[ ( "$TRIGGER" == "push" || "$TRIGGER" == "schedule" || "$TRIGGER" == "workflow_dispatch" ) && "$GITHUB_REF" == "refs/heads/main" ]]; then
99- echo "exporting dev as target helm repo: ${{ env.DEV_REPO_HELM_URL }}"
100- echo "helm_repo=${{ env.DEV_REPO_HELM_URL }}" >> "$GITHUB_OUTPUT"
92+ echo "skip_helm=false" >> "$GITHUB_OUTPUT"
10193 elif [[ "$TRIGGER" == "push" && $GITHUB_REF == refs/tags/* ]]; then
102- echo "exporting stable as target helm repo: ${{ env.STABLE_REPO_HELM_URL }}"
103- echo "helm_repo=${{ env.STABLE_REPO_HELM_URL }}" >> "$GITHUB_OUTPUT"
94+ echo "skip_helm=false" >> "$GITHUB_OUTPUT"
10495 else
10596 echo "Unknown trigger and ref combination encountered, skipping publish step: $TRIGGER $GITHUB_REF"
106- echo "helm_repo=skip " >> "$GITHUB_OUTPUT"
97+ echo "skip_helm=true " >> "$GITHUB_OUTPUT"
10798 fi
10899
109100 run_cargodeny :
@@ -317,7 +308,7 @@ jobs:
317308 name : Package Charts, Build Docker Image and publish them - ${{ matrix.runner }}
318309 needs :
319310 - tests_passed
320- - select_helm_repo
311+ - check_helm_publish
321312 strategy :
322313 matrix :
323314 runner : ["ubuntu-latest", "ubicloud-standard-8-arm"]
@@ -326,13 +317,11 @@ jobs:
326317 permissions :
327318 id-token : write
328319 env :
329- NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
330- HELM_REPO : ${{ needs.select_helm_repo.outputs.helm_repository }}
331320 OCI_REGISTRY_SDP_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
332321 OCI_REGISTRY_SDP_USERNAME : " robot$sdp+github-action-build"
333322 OCI_REGISTRY_SDP_CHARTS_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_CHARTS_GITHUB_ACTION_BUILD_SECRET }}
334323 OCI_REGISTRY_SDP_CHARTS_USERNAME : " robot$sdp-charts+github-action-build"
335- if : needs.select_helm_repo .outputs.helm_repository != 'skip '
324+ if : needs.check_helm_publish .outputs.skip_helm != 'true '
336325 outputs :
337326 IMAGE_TAG : ${{ steps.printtag.outputs.IMAGE_TAG }}
338327 steps :
@@ -379,9 +368,7 @@ jobs:
379368 PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}"
380369 sed -i "s/version = \"${MANIFEST_VERSION}\"/version = \"${PR_VERSION}\"/" Cargo.toml
381370
382- # Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
383- # default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
384- # This is needed for the HELM_REPO variable.
371+ # Recreate charts and publish charts and docker image.
385372 - name : Install cosign
386373 uses : sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
387374 - name : Install syft
@@ -397,21 +384,21 @@ jobs:
397384 sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_arm64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
398385 fi
399386
400- make -e build
387+ make build
401388 - name : Publish Docker image and Helm chart
402389 if : ${{ !github.event.pull_request.head.repo.fork }}
403390 run : |
404391 # We want to publish helmcharts only once as they have a common name, while still publishing both images with architecture specific tags
405392 if [ "$(uname -m)" = "x86_64" ]; then
406- make -e publish
393+ make publish
407394 else
408- make -e docker-publish
395+ make docker-publish
409396 fi
410397 # Output the name of the published image to the Job output for later use
411398 - id : printtag
412399 name : Output image name and tag
413400 if : ${{ !github.event.pull_request.head.repo.fork }}
414- run : echo "IMAGE_TAG=$(make -e print-docker-tag)" >> "$GITHUB_OUTPUT"
401+ run : echo "IMAGE_TAG=$(make print-docker-tag)" >> "$GITHUB_OUTPUT"
415402
416403 create_manifest_list :
417404 name : Build and publish manifest list
@@ -422,7 +409,6 @@ jobs:
422409 permissions :
423410 id-token : write
424411 env :
425- NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
426412 OCI_REGISTRY_SDP_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
427413 OCI_REGISTRY_SDP_USERNAME : " robot$sdp+github-action-build"
428414 OCI_REGISTRY_SDP_CHARTS_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_CHARTS_GITHUB_ACTION_BUILD_SECRET }}
0 commit comments