32
32
RUSTFLAGS : " -D warnings"
33
33
RUSTDOCFLAGS : " -D warnings"
34
34
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
38
35
39
36
jobs :
40
37
# Identify unused dependencies
@@ -63,47 +60,41 @@ jobs:
63
60
- uses : stackabletech/cargo-install-action@cargo-udeps
64
61
- run : cargo udeps --workspace --all-targets
65
62
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.
68
65
#
69
66
# The following scenarios are identified:
70
- # - all pull requests land in the test repository :
67
+ # - all pull requests land are published :
71
68
# condition: github.event_name == "pull_request"
72
- # repository: test
73
69
#
74
- # - all tagged releases land in stable :
70
+ # - all tagged releases are published :
75
71
# condition: github.event_name == 'push' & github.ref.startswith('refs/tags/')
76
- # repository: stable
77
72
#
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 :
79
74
# condition: ( github.event_name == 'push' | github.event_name == 'schedule' | github.event_name == 'workflow_dispatch' ) & github.ref == 'refs/heads/main'
80
- # repository: dev
81
75
#
82
76
# 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
83
77
# 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
86
80
runs-on : ubuntu-latest
87
81
outputs :
88
- helm_repository : ${{ steps.selecthelmrepo .outputs.helm_repo }}
82
+ skip_helm : ${{ steps.checkhelmpublish .outputs.skip_helm }}
89
83
steps :
90
- - id : selecthelmrepo
84
+ - id : checkhelmpublish
91
85
env :
92
86
TRIGGER : ${{ github.event_name }}
93
87
GITHUB_REF : ${{ github.ref }}
94
88
run : |
95
89
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"
98
91
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"
101
93
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"
104
95
else
105
96
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"
107
98
fi
108
99
109
100
run_cargodeny :
@@ -317,7 +308,7 @@ jobs:
317
308
name : Package Charts, Build Docker Image and publish them - ${{ matrix.runner }}
318
309
needs :
319
310
- tests_passed
320
- - select_helm_repo
311
+ - check_helm_publish
321
312
strategy :
322
313
matrix :
323
314
runner : ["ubuntu-latest", "ubicloud-standard-8-arm"]
@@ -326,13 +317,11 @@ jobs:
326
317
permissions :
327
318
id-token : write
328
319
env :
329
- NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
330
- HELM_REPO : ${{ needs.select_helm_repo.outputs.helm_repository }}
331
320
OCI_REGISTRY_SDP_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
332
321
OCI_REGISTRY_SDP_USERNAME : " robot$sdp+github-action-build"
333
322
OCI_REGISTRY_SDP_CHARTS_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_CHARTS_GITHUB_ACTION_BUILD_SECRET }}
334
323
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 '
336
325
outputs :
337
326
IMAGE_TAG : ${{ steps.printtag.outputs.IMAGE_TAG }}
338
327
steps :
@@ -379,9 +368,7 @@ jobs:
379
368
PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}"
380
369
sed -i "s/version = \"${MANIFEST_VERSION}\"/version = \"${PR_VERSION}\"/" Cargo.toml
381
370
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.
385
372
- name : Install cosign
386
373
uses : sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
387
374
- name : Install syft
@@ -397,21 +384,21 @@ jobs:
397
384
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_arm64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
398
385
fi
399
386
400
- make -e build
387
+ make build
401
388
- name : Publish Docker image and Helm chart
402
389
if : ${{ !github.event.pull_request.head.repo.fork }}
403
390
run : |
404
391
# We want to publish helmcharts only once as they have a common name, while still publishing both images with architecture specific tags
405
392
if [ "$(uname -m)" = "x86_64" ]; then
406
- make -e publish
393
+ make publish
407
394
else
408
- make -e docker-publish
395
+ make docker-publish
409
396
fi
410
397
# Output the name of the published image to the Job output for later use
411
398
- id : printtag
412
399
name : Output image name and tag
413
400
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"
415
402
416
403
create_manifest_list :
417
404
name : Build and publish manifest list
@@ -422,7 +409,6 @@ jobs:
422
409
permissions :
423
410
id-token : write
424
411
env :
425
- NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
426
412
OCI_REGISTRY_SDP_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
427
413
OCI_REGISTRY_SDP_USERNAME : " robot$sdp+github-action-build"
428
414
OCI_REGISTRY_SDP_CHARTS_PASSWORD : ${{ secrets.HARBOR_ROBOT_SDP_CHARTS_GITHUB_ACTION_BUILD_SECRET }}
0 commit comments