jenkinsci / jenkinsci/gitlab-plugin

Jenkins 2.2xx reporting a 401 error when token provided from gitlab.

Open
#1,095 4 comments 4 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

## 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://:8080/job//

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://:@:8080/job//

looks like "1826463627266737..."

(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/

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](https://github.com/jenkinsci/gitlab-plugin#user-support).
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.