GitLab webhook trigger using Jenkins integration fails

Hi all,

I have recently started using Jenkins and I’m getting all my integrations set up. Naturally, I’m facing a few instances where I’m searching docs for answers on how to set things up.

I’m having a similar problem with this closed issue on GitHub.
Web hook fails when Jenkins Anonymous user does not have job/build permission

Currently, I don’t have a username or password specified in the Jenkins integration in GitLab because I couldn’t get it to successfully test the connection when doing so. So, it makes sense that the webhook is being triggered by the “anonymous” user and correctly failing.

I think the reason I could not get the username and password part with the Jenkins integration in GitLab working is related to the fact I have my Jenkins instance authentication setup to use the OAuth of my GitLab instance to protect Jenkins with two-factor authentication, since I am exposing it publicly. The OAuth integration is working perfectly as expected in Jenkins. But when I try to use my GitLab username and password in the webhook integration it fails the test connection.

The issue on GitHub above mentions creating a special “jenkins” user to make the call from GitLab but as I am using GitLab OAuth I can’t seem to find a way to create a basic local user in Jenkins.

I don’t want the webhooks to be unprotected.

Does anyone know of a solution to this scenario?

Any help would be greatly appreciated.

Thanks,

FS

Finally found the solution.

Create an API token for the user in Jenkins and use that as the password in GitLab.