2

In GitLab, I just wan to the merge requests from sit -> uat -> master.

How can I implement it by pipeline?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

0

You should be albe to use a combination of:

  • rules:if, as illustrated in workflow:rules
  • Predefined variables reference, like
    • CI_PIPELINE_SOURCE: How the pipeline was triggered
    • CI_MERGE_REQUEST_TARGET_BRANCH_NAME: The target branch name of the merge request.
    • CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: The source branch name of the merge request.

Something like:

sit-to-uat:
  stage: build
  image: yourImage
  script:
    - # do something
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && 
           $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^sit$/' && 
           $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^uat$/'
      when: always 
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250