Skip to content

Commit 9d8ad48

Browse files
IONOS(build): extend branch support to include 'rc/*' for remote workflow triggers
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
1 parent 23d109a commit 9d8ad48

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

.github/workflows/build-artifact.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
branches:
3232
- ionos-dev
3333
- ionos-stable
34+
- 'rc/*'
3435
workflow_dispatch: # Manual trigger to bypass all caches
3536
inputs:
3637
force_rebuild:
@@ -142,9 +143,9 @@ jobs:
142143
echo " ✅ Event type is 'push'"
143144
fi
144145
145-
if [ "${{ github.ref_name }}" != "ionos-dev" ] && [ "${{ github.ref_name }}" != "ionos-stable" ]; then
146-
echo "- ❌ Branch must be 'ionos-dev' or 'ionos-stable' (current: \`${{ github.ref_name }}\`)" >> $GITHUB_STEP_SUMMARY
147-
echo " ❌ Branch is '${{ github.ref_name }}' (must be 'ionos-dev' or 'ionos-stable')"
146+
if [ "${{ github.ref_name }}" != "ionos-dev" ] && [ "${{ github.ref_name }}" != "ionos-stable" ] && ! [[ "${{ github.ref_name }}" =~ ^rc/ ]]; then
147+
echo "- ❌ Branch must be 'ionos-dev', 'ionos-stable', or 'rc/*' (current: \`${{ github.ref_name }}\`)" >> $GITHUB_STEP_SUMMARY
148+
echo " ❌ Branch is '${{ github.ref_name }}' (must be 'ionos-dev', 'ionos-stable', or 'rc/*')"
148149
WILL_TRIGGER=false
149150
else
150151
echo "- ✅ Branch is '\`${{ github.ref_name }}\`'" >> $GITHUB_STEP_SUMMARY
@@ -908,13 +909,22 @@ jobs:
908909

909910
name: Trigger remote workflow
910911
needs: [upload-to-artifactory]
911-
# Trigger remote build on "ionos-dev|ionos-stable" branch *push* defined in the on:push:branches
912+
# Trigger remote build on "ionos-dev|ionos-stable|rc/*" branch *push* defined in the on:push:branches
912913
# Can be disabled via repository variable 'DISABLE_REMOTE_TRIGGER' (set to 'true' to disable)
913914
# Configure at: https://github.com/IONOS-Productivity/ncw-server/settings/variables/actions
915+
#
916+
# Branch to GitLab Trigger Mapping:
917+
# ┌──────────────┬──────────────┬─────────────┐
918+
# │ ref_name │ GITLAB_REF │ BUILD_TYPE │
919+
# ├──────────────┼──────────────┼─────────────┤
920+
# │ ionos-dev │ stable │ dev │
921+
# │ ionos-stable │ stable │ stable │
922+
# │ rc/* │ main │ rc │
923+
# └──────────────┴──────────────┴─────────────┘
914924
if: |
915925
always() &&
916926
github.event_name == 'push' &&
917-
(github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable') &&
927+
(github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable' || startsWith(github.ref_name, 'rc/')) &&
918928
needs.upload-to-artifactory.result == 'success' &&
919929
vars.DISABLE_REMOTE_TRIGGER != 'true'
920930
steps:
@@ -926,16 +936,32 @@ jobs:
926936
# Determine build type based on branch:
927937
# - 'ionos-dev' branch triggers 'dev' build type
928938
# - 'ionos-stable' branch triggers 'stable' build type
939+
# - 'rc/*' branches trigger 'rc' build type
929940
BUILD_TYPE="dev"
930941
931942
# Override build type for stable branch
932943
if [ "${{ github.ref_name }}" == "ionos-stable" ]; then
933944
BUILD_TYPE="stable"
934945
fi
935946
947+
# Override build type for rc/* branches
948+
if [[ "${{ github.ref_name }}" =~ ^rc/ ]]; then
949+
BUILD_TYPE="rc"
950+
fi
951+
952+
# Determine GitLab target branch based on build type
953+
# - 'dev' and 'stable' build types target 'stable' branch
954+
# - 'rc' build type targets 'main' branch
955+
GITLAB_REF="stable"
956+
if [ "$BUILD_TYPE" == "rc" ]; then
957+
GITLAB_REF="main"
958+
fi
959+
936960
# Construct source build URL for traceability
937961
SOURCE_BUILD_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
938962
echo "Source Build URL: $SOURCE_BUILD_URL"
963+
echo "Build Type: $BUILD_TYPE"
964+
echo "GitLab Target Branch: $GITLAB_REF"
939965
940966
# Trigger GitLab pipeline via webhook with retry logic (3 attempts with 30s delay)
941967
MAX_ATTEMPTS=3
@@ -953,7 +979,7 @@ jobs:
953979
--fail-with-body \
954980
-o response.json \
955981
--form token=${{ secrets.GITLAB_TOKEN }} \
956-
--form ref="stable" \
982+
--form ref="${GITLAB_REF}" \
957983
--form "variables[GITHUB_SHA]=${{ github.sha }}" \
958984
--form "variables[ARTIFACTORY_LAST_BUILD_PATH]=${{ needs.upload-to-artifactory.outputs.ARTIFACTORY_LAST_BUILD_PATH }}" \
959985
--form "variables[NC_VERSION]=${{ needs.build-artifact.outputs.NC_VERSION }}" \

0 commit comments

Comments
 (0)