Webhook events

Using Jenkins with the GitLab plugin. I just want to make sure I am using this correctly.
I would like a Jenkins job to be completed when a commit on any branch is pushed. For this I can use a push event webhook.
Then a merge request is created and approved and (hopefully) merged.
Merging may create new code which needs to be built and tested.

Is my best approach to create a Jenkins job or pipeline that is watching the integration branch with a push event?

Or to use a merge request webhook which will run on creation. And the actual merge. Is there a way to run the build on the merged code before the merge request is approved and actioned?

I understand that your main question is, whether to run CI pipelines on all branches or on the integration branch only, correct? IMHO, it depends on how much time runs your job. If it is does not take much time, why not run it on all pushes? If it is heavy, run it on the integration branch only. Maybe you can create two types of pipelines, a lighter one for development branches and a heavier one for integration?

Now regarding merge requests: if you want to test the merged code before creating a merge request, you can merge from integration to development first, run the build there and only afterwards create a merge request.

1 Like

Thanks for this Alex.
But is there a way of checking that integration has been rebased (merged, not git rebase) into the development branch?