'Jenkins job does not trigger on gitlab merge request

I try to launch a build of jenkins when a merge request is opened and accepted through a gitlab webhook.

jenkins build trigger

It works fine when I open the merge event. But it never launch when i accept the merge request and i can't seem to figure out why.

please note that this my pipeline(jenkinsfile) is a simple one with conditioned stages for some to run when the merge is opened and other stages to run when the merge is validated. The trigger works fine when i separate the jobs (pre and post merge) but does not when i try to combine things in one simple job



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source