11

In the merge checks settings, I have enabled the "pipelines must succeed" option:

enter image description here

But the branches without any jobs are stuck at merge by saying "waiting for pipelines status" and you can't merge without a successful pipeline.

Can I enable the "pipelines must succeed" option only for some specific branches like master/production?

DV82XL
  • 5,350
  • 5
  • 30
  • 59
shaik reyan
  • 129
  • 1
  • 8

2 Answers2

6

As a workaround, you can trigger a merge request pipeline from the branches that don't currently have any jobs. The pipeline can have a single job that always passes. A merge request pipeline will only be created after a MR is created, not before.

A simple job like this should work:

print-info:
  stage: setup
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
  script:
    - 'echo "Job start: $CI_JOB_STARTED_AT"'
    - 'echo "Branch: $CI_COMMIT_BRANCH"'
    - 'echo "Commit Author: $CI_COMMIT_AUTHOR"'

Note: I'm not sure what your current pipeline looks like, so you may have to change the rules section to suit your needs.

DV82XL
  • 5,350
  • 5
  • 30
  • 59
  • 1
    Thanks for sharing this answer, I know this works but just wanted know where there is an option to get rid of this dummy pipeline, so that the runner can be free for some other pipelines. It seems its the gitlab limitation. – shaik reyan Nov 02 '21 at 17:22
5

I think that is not possible.

You should ensure that there is always a pipeline and that it’s successful.

GitLab MR / when pipelines succeed / limitations

Jakob Liskow
  • 1,323
  • 14
  • 22