Merge request considering merge-request pipelines instead of branch pipelines

Greetings,

In my project, a pipeline runs on every branch commit. This pipeline consists of all the builds, lint, unit tests, etc…
Another pipeline runs when i raise a merge request from feature branch to main. This pipeline mainly consist of sonar-scanner to scan the code and display the result on the merge request screen (merge_request deocration).

I have change the merge request settings to allow to merge only when the pipeline succeeds. But now the problem is it considers the merge_request pipeline and not the branch pipeline.

That means, if the branch pipeline fails i.e. unit test, build, lint fails, it will allow me to merge to main if the sonar scanner succeeds.

Do i have any workaround for this?

This is expected behavior, as merge request pipeline are considered superior to branch pipelines.

I believe what most people do (including me) is switching over to merge request pipelines once MR is open, and having the full pipeline (build, lint, test + sq scan) running on merge request pipelines, and branch pipelines do not run anymore - here is official way to do this.

Hope this helps! :slight_smile: