Jenkins 2.2xx reporting a 401 error when token provided from gitlab.
Issue
I have gitlab 13.5.2-ee on our internal network.
I have two build servers: The old one (Jenkins 2.190.3, CSRF protection turned off, plugins: git 4.0.0, git client, 3.0.0, gitlab plugin 1.5.13).
The new one (Jenkins 2.249.2, CSRF not turned off, default crumb issuer, enable proxy compatibility, plugins: git 4.4.5, git client: 3.5.1, gitlab api, 1.0.6, gitlab authentication: 1.10, gitlab branch source: 1.5.1, gitlab logo plugin: 1.0.5, gitlab merge request builder: 2.0.0, gitlab plugin: 1.5.13).
The old one can accept a url like this on push-to-the-repo to run unit tests: http://<machineName>:8080/job/<projectName>/
The new one gets a "403 No valid crumb" error for the same url.
Fair enough, CSRF and all that.
The readme for gitlab plugin seems pretty clear here: https://github.com/jenkinsci/gitlab-plugin
(Even if there's no 'Show API Token' button, as there are no Legacy tokens.)
I should:
- In an account that can build create an API token in Jenkins (done).
- copy the userID from above and the token to the url hit on the new machine:
http://<userID>:
(Leaving the Secret Token field empty.)
Now, when gitlab runs, it returns a 401 "Invalid token".
Look in the logs, and it just says: Jan 18, 2021 2:11:01 PM INFO com.dabsquared.gitlabjenkins.webhook.GitLabWebHook getDynamic WebHook called with url: /project/<projectName>
Search in the readme, find the 'Getting help'. Follow those instructions. Still get the 401, still the same error message in the recorder, but it also shows the json data sent for the request...but no errors.
So, any other suggestions about why Jenkins is returning a 401?
Context
- Gitlab plugin version: X.Y.Z
- Gitlab version: 13.5.2-ee
- Jenkins version: X.Y.Z
- Job type: Pipeline, Freestyle, Matrix, etc.
Logs & Traces
Please include any relevant log that could serve to better understand the source of your issue For Jenkins Gitlab Plugin logs, follow instruction in User Support section. For Gitlab logs, ask an administrator to provide you the relevant Gitlab logs.
Problem description
Describe your problem in a meaningful way:
- what were you doing (simple push, merge request, MR with fork, ...)
- what was expected
- what occurred finally
Hello, have you resolved this issue? I get the same issue here
Nope, haven't resolved the issue.
It's rather disappointing.
I get the same issue here
HTTP ERROR 401 Invalid token
| URI: | /project/test |
|---|---|
| 401 | |
| Invalid token | |
| Stapler |
Powered by Jetty:// 9.4.42.v20210604