Jenkins GitLab Branch Source plugin fails with 403 on GitLab CE

Hi all,

I’m trying to integrate Jenkins with a self-hosted GitLab Community Edition instance and the GitLab Branch Source Plugin.

Environment:

  • GitLab CE version: [your version]

  • Jenkins version: 2.516.1

  • GitLab Branch Source Plugin: [your version]

What I did:

  • Created a Personal Access Token with all available scopes (api, read_api, read_repository, write_repository).

  • Also tested with a full Admin user (instance-wide admin, not just group Owner).

  • Verified the token works with curl, for example:

    curl -H "PRIVATE-TOKEN:xxxxx" https://gitlab.example.com/api/v4/groups/kubernetes
    
    

    → returns the expected JSON.

Problem:
When Jenkins scans the GitLab group with the organization folder job, it fails with:

org.gitlab4j.api.GitLabApiException: 403 Forbidden - Not authorized to access /api/v4/users
Caused: java.lang.IllegalStateException: Unable to fetch

Try to test from server instance the curl. Each plugin has way to enable different log level and this can be helpful. Open an issue on gitlab plugin. I did not see reported similar recently. If I remember there is a version compatibility table for gitlab server.

Hi all,

I manage to solve the problem I use the incorrect user in Jenkins