'Exception in integrating gitlab with jenkins
I have a project created and configured on private Gitlab v9.0 instance. I have imported this project on Jenkins v2.46.1, the connection with gitlab is successful. Afterwards, I tried to configure build trigger on push event from repo in gitlab. I have generated secret token for it on jenkins and added a webhook with Gitlab CI URL and secret token when I tried to test the webhook it returned me below exception
Hook executed successfully but returned HTTP 403 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>Error 403 anonymous is missing the Job/Build permission</title> </head> <body><h2>HTTP ERROR 403</h2> <p>Problem accessing /project/tapp-builder-service. Reason: <pre> anonymous is missing the Job/Build permission</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/> </body> </html>
Can anyone please help me solving this?
Solution 1:[1]
You can either add a special user in Jenkins for this and configure the Webhook in GitLab accordingly or you can uncheck the checkbox "Enable authentication for '/project' end-point" in the GitLab section of the global Jenkins configuration. But this should be unchecked by default.
Solution 2:[2]
The best way to configure this is
- Jenkins global configuration ->
Require authorization for /project endpoint Copy userid and API key for a Jenkins user who has authorization to run the job
Create a webhook on GitLab to trigger the job
Then use HTTP basic auth (Below format):
Solution 3:[3]
The best option is to create a secret token (from Jenkins) and then add it to the gitlab webhook's secret key
Solution 4:[4]
Make sure to save the changes of the configuration (i.e generated secret token) on Jenkins server first before copying it to the Gitlab Webhook page
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | lax1089 |
| Solution 2 | |
| Solution 3 | Ramindu Samarawickrama |
| Solution 4 | farch |
