Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI - Run the job on merge request to specific branch

Tags:

gitlab-ci

I want configure my CI with a following condition :

  • When i create a merge request
  • And this target branch is develop

My job runs.

I don't find a documentation for this specific job.

Thanks

like image 701
Gary Houbre Avatar asked Oct 17 '25 15:10

Gary Houbre


1 Answers

After severals hours in Gitlab CI documentation i found this solution.

unit_test:
    stage: test
    rules:
        - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"'
    script:
        - echo "Test running"
        - ... 
like image 99
Gary Houbre Avatar answered Oct 19 '25 11:10

Gary Houbre