Commit a5d87d38 authored by Yorick Peterse's avatar Yorick Peterse

Use MR SOURCE_BRANCH_NAME to prevent RC pipelines

When creating a merge request to merge release-tools/X into a stable
branch, using CI_COMMIT_BRANCH still results in a detached pipeline
being created, likely due to this variable not being set in that case.
To work around this we have to use CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
instead, which is always set to the value we'd expect.

This fixes https://gitlab.com/gitlab-com/gl-infra/delivery/-/issues/822
parent 00605603
......@@ -30,7 +30,7 @@ workflow:
# merge requests used for this merge a branch release-tools/X into a stable
# branch. For these merge requests we don't want to run any pipelines, as
# they serve no purpose and will run anyway when the changes are merged.
- if: '$CI_COMMIT_BRANCH =~ /^release-tools\/\d+\.\d+\.\d+-rc\d+$/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^[\d-]+-stable(-ee)?$/ && $CI_PROJECT_PATH == "gitlab-org/gitlab"'
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^release-tools\/\d+\.\d+\.\d+-rc\d+$/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^[\d-]+-stable(-ee)?$/ && $CI_PROJECT_PATH == "gitlab-org/gitlab"'
when: never
# For merge requests, create a pipeline.
- if: '$CI_MERGE_REQUEST_IID'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment