Exception in integrating gitlab with jenkins
Solution 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
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
The best option is to create a secret token (from Jenkins) and then add it to the gitlab webhook's secret key
Related videos on Youtube
vsbehere
By day I am a Software Engineer at Aino Softwares. By night I write code for my own practice and to explore various technologies. I like you go for trekking or to adventures trips for fun. "There's always plenty of room for improvement - in your code, in your abilities, in you."
Updated on July 02, 2022Comments
-
vsbehere almost 2 years
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?
-
Vin Shahrdar over 5 yearsI have created the secret token from Jenkins and included it in gitlab's Jenkins integration, but I am getting the same error. I've also tried generating a secret key in the Jenkins project I am trying to run. What else can I try?
-
gogagubi over 4 yearsI don't know why this answer didn't have vote so far, but this is only working example I have tried so far