0
votes

I'm trying to execute my jobs automatically from Gitlab webhooks with this instructions: https://github.com/jenkinsci/gitlab-plugin Now I have a Gitlab webhook when I test it the response is 200, but the response headers is

Response headers:

Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 24 Oct 2018 20:43:43 GMT
Transfer-Encoding: chunked
Connection: close
X-Content-Type-Options: nosniff

Without response body

This is the expected response or an error?, my job is a multibranch pipeline, in Jenkins the job is not executed. My Jenkins work behind a proxypass with Nginx and the structure of my webhook url in Gitlab is https://jenkinsuser:[email protected]/project/myjob In the Jenkins global configuration, in the Gitlab plugin in my Jenkins I can do a success test of the connection from Jenkins to Gitlab. I not have any idea about what is wrong But in https://jenkinsuser:[email protected]/project/myjob what is myjob? This: DOT_testing-webhook or this: view/DevOps/job/DOT_testing-webhook/job/master/

The execution of curl -X POST https://USER:[email protected]/project/DOT_testing-webhook/dev response:

HTTP ERROR 404

Problem accessing /project/DOT_testing-webhook/dev. Reason:

    Not Found

Powered by Jetty:// 9.4.z-SNAPSHOT
1

1 Answers

0
votes

Response 200 looks OK. Response body depends on the plugin I guess. I use Generic Webhook Trigger Plugin and my response body has the Jenkins job name that was/ will be triggered. In your case maybe response body is blank because webhook could not find the job you configured in your webhook url or the plugin doesn't send any response back.

Your webhook URL should be in the below format as your job is within DOT_testing-webhook folder:

https://USERID:APITOKEN@JENKINS_URL/project/DOT_testing-webhook/master (if using global authentication - https://github.com/jenkinsci/gitlab-plugin#configuring-global-authentication)

https://JENKINS_URL/project/DOT_testing-webhook/master (if using per-project authentication - https://github.com/jenkinsci/gitlab-plugin#configuring-per-project-authentication) You will need to configure token in the Secret Token field in GitLab