jenkinsgitlab-7

Trigger Jenkins build with POST request


This seems to be a very simple problem, but I have yet found a solution that works. Basically I created a web hook from Gitlab to trigger a build in Jenkins for every commit. However, Jenkins want the web hook request with a GET method, and Gitlab web hook makes a request with a POST method. Is there anyway to work around this problem?

From the search I've done, it seems Jenkins used to want a POST request, but it is no longer the case. I am using Jenkins 1.610 with Gitlab 7.9.4.


Solution

  • It turns out that because I enabled CSRF protection, any non-GET request to Jenkins is rejected. Disable CSRF, and I can trigger Jenkins with POST request.