I will explain my problem with a scenario to make it understandable.
What I have:
main
branch (default, protected): have .gitignore + locked cicd.yml
filefeature
branch: copied from main and then added required feature.gitlab-ci.yml
file contains build and deploy jobs for the project (needs merge request predefined variables– title + description)
The wanted scenario:
- dev commits changes to
feature
branch and request a merge tomain
needs approval ->.gitlab-ci.yml
doesn’t run - when request is approved then merged run
.gitlab-ci.yml
inmain
notfeature
using$CI_MERGE_REQUEST_*
predefined variables (title and description)
I have tried the follwing workflow rules
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_APPROVED && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_MERGE_REQUEST_TITLE =~ /^vd+(.d+){2}$/ && $CI_MERGE_REQUEST_DESCRIPTION != "" && $CI_MERGE_REQUEST_DESCRIPTION =~ $MERGE_REQUEST_DESC_PATTERN && $CI_MERGE_REQUEST_EVENT_TYPE == "merged_result"
I need to check $CI_MERGE_REQUEST_TITLE
and $CI_MERGE_REQUEST_DESCRIPTION
so they can’t be removed (they are also used to build the image $CI_MERGE_REQUEST_TITLE
is image tag)
is it possible to achieve this scenario? if not can you suggest a workaround
thank you in advance