Gary Houbre
Gary Houbre

Reputation: 880

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

I want configure my CI with a following condition :

My job runs.

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

Thanks

Upvotes: 4

Views: 2082

Answers (1)

Gary Houbre
Gary Houbre

Reputation: 880

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"
        - ... 

Upvotes: 9

Related Questions