I’d like to create a separate pipeline when an MR is related to a hotfix. For this matter, I am making an assumption that whenever the branch name starts with hotfix/ then it needs to be treated differently. The below rule is what I have used for this matter:
rules: - if: '($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^hotfix\/.*$/) || ($CI_COMMIT_REF_NAME == "mater" && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^hotfix\/.*$/)'
This condition works when there is an MR created so the first part of the condition works as expected. However, the second part does not work as
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME does not exist. Apparently, when an MR is merged all traces of the source branch is removed so I am not sure how I can find out if that was a hotfix or not.