I'm trying to make it so my Jenkins job builds automatically when I push to a gitlab repository. For this, im using the 'GitLab Plugin' for Jenkins.
Here is what's working:
- I can build the job manually.
- Jenkins can access my GitLab project using an API key.
Here is the problem: I configured my Jenkins project and it gave me a URL to use with a GitLab webhook. I also use a secret token.
In GitLab, I add this webhook using the EXACT same url that the plugin gives me, and I add the secret token as well. I disable SSH. Upon testing, it returns HTTP 404 with the following message:
Hook executed successfully but returned HTTP 404 <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 404 Not Found</title> </head> <body><h2>HTTP ERROR 404 Not Found</h2> <table> <tr><th>URI:</th><td>/project/UnitTestFramework%20-%20Gaspar%20Tamas</td></tr> <tr><th>STATUS:</th><td>404</td></tr> <tr><th>MESSAGE:</th><td>Not Found</td></tr> <tr><th>SERVLET:</th><td>Stapler</td></tr> </table> <hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.30.v20200611</a><hr/> </body> </html>
For reference the URL looks something like this:
http://jenkins.server.address.com:8282/project/My%20Project%20Name
with server name and project name replaced of course, whitespaces are escaped using %20. I don't see what could be wrong with this URL, as the GitLab plugin gives it to me, there can be no typo or anything.