Gitlab webhook does not start the Jenkins build job on "Accepted Merge Request Events"

GitLab 10.7.3
Jenkins 2.107.3
CentOS 7.5 (1804)

I successfully configured the Jenkins and GitLab to integrate with each other through the GitLab Webhook API. The build jobs are triggered for the push events, no problems.

But what I really want, is to have the build jobs triggered only when a merge request is “completed”.
Right now, the build jobs are being triggering when the merge request is submitted.

For the GitLab webhook, I selected check boxes:
“Issues events”
“Merge request events”

For the Jenkins job, I selected:
“Build when a change is pushed o GitLab”
- Push events
- Accepted merge request events
- Comments

Result: I get the merge in GitLab but not the build in Jenkins

When I add:
“Build when a change is pushed o GitLab”
- Opened merged request events

The Jenkins build job is started.

I did read how GitLab defines the merge request event trigger:
“Triggered when a new merge request is created, an existing merge request was
updated/merged/closed or a commit is added in the source branch”

Is there some method to trick the trigger to only work when the merge request is accepted and not opened?


1 Like

Having the same problem. We can definitely see pushed commits in remote branch but they are not firing webhook notifications to jenkins.

But if you click on test webhook button from the settings page in gitlab, it triggers the webhook notification and jenkins starts a build on a default branch.

So it seems like the problem is on gitlab shell side.

I think the problem is GitLab fires Merge Request webhook event when merge request merged, but it doesn’t fire Push event to the webhook causing the build not to be started automatically.