diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-22 15:10:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-22 15:10:30 +0300 |
commit | 49203bfa3c7eb607a7561ae7da9b5c52aa49fd77 (patch) | |
tree | f33cd54ec9a45d69a3e58fe93735070d3b718913 /scripts | |
parent | 3c9a2dd62025043448c9ea9a6df86422874ee4be (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/utils.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh index 1d3c04dd64e..5996fe7724c 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -453,3 +453,21 @@ function download_local_gems() { rm "${output}" done } + +function define_trigger_branch_in_build_env() { + target_branch_name="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_COMMIT_REF_NAME}}" + stable_branch_regex="^[0-9-]+-stable(-ee)?$" + + echo "target_branch_name: ${target_branch_name}" + + if [[ $target_branch_name =~ $stable_branch_regex ]] + then + export TRIGGER_BRANCH="${target_branch_name%-ee}" + else + export TRIGGER_BRANCH=master + fi + + if [ -f "$BUILD_ENV" ]; then + echo "TRIGGER_BRANCH=${TRIGGER_BRANCH}" >> $BUILD_ENV + fi +} |