How Do You Troubleshoot the GitLab Integration Webhook Error “Permission you need to have (but didn’t) hudson.model.Hudson”?

Problem scenario
You are trying to configure GitLab to work with Jenkins (so the two are integrated to enable  CI, continual integration, in your environment).  When you test a connection of an integration  webhook from GitLab to reach out to Jenkins you receive this error:

"Hook executed successfully but returned HTTP 403... You are authenticated as anonymous Groups that you are in: Permission you need to have (but didn't) hudson.model.Hudson.Read...which is implied by hudson.security.Permission.GenericRead..."

How do you solve this problem?

Solution

1.  In Jenkins install the Build Authorization Token Root Plugin if it is not already installed.  If it is installed, skip to step #5.
2.  To install it log into Jenkins. 
3.  Go to Plugin Manager -> Available. 
4.  Check the box for "Build Authorization Token Root Plugin."
5.  Check the button "Install without restart."
6.  Go to the Jenkins job in this scenario. 
7.  Click "Configure" -> "Build Triggers". 
8.  Check the option "Trigger builds remotely..." option.  
9.  Insert an arbitrary string in the "Authentication Token" field.  
10.  Click Save.
11.  Copy the URL for the job and draft it according to this format:  

http://JENKINS_URL/buildByToken/build?job=JOBNAME&token=TOKENNAME

Substitute JENKINS_URL for the URL to your Jenkins server (e.g., with port 8080).  Substitute JOBNAME for the name of the job.  Substitute TOKENNAME with the arbitrary string you entered above in the "Authentication Token" field.

12.  Copy this URL and paste it in the GitLab field for the URL in the integration webhook. 
13.  Test the connection again.

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *