0

I am lots of branches in my repo, now I want to add MR pipeline for the master branch, and enable the Merge checks and Pipelines must succeed optional. unfortunately the repo have so many branches that I don't want to create .gitlab-ci.yml for them one by one. but as I have enabled the options for merge check, MR to the branched are stuck because they are not passed pipeline(no pipeline is configured for the branch). So anyone can help me out?

Leon
  • 1,935
  • 3
  • 23
  • 36

1 Answers1

0

Can you also paste an snipped of your .gitlab-ci.yml file?

Hoping you must have tried this to your stages?

  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'master'

This basically will run only for a merge request to the master branch. And this chunk should be inside the source branch .gitlab-ci.yml

Abid Khan
  • 145
  • 2
  • 9
  • Yes, it seems I have add `.gitlab-ci.yml` for every source branch. :-{. It's really stupid..... – Leon Sep 19 '22 at 01:58
  • I understand that's annoying, but that's how it is. There are ways to maintain repeated things by including or referencing them. But yes, you have to add it to all the source branch. I would also like to know if there is any better way to do so :-). Let's hope other answers it. – Abid Khan Sep 19 '22 at 04:44