I am trying to configure a secured Jenkins server in a company network where GitLab CE is already running. I have set the access control and the authorization system in Jenkins via the GitLab Authentication Plugin and a trusted application in Jenkins with admin rights and API and read_repo scopes.

The authentication is working great, and users are automatically logged into Jenkins with their GitLab's username as soon as they get into the Jenkins server portal.

However, I have found some trouble to set the GitLab connection that should enable pulling from GitLab and reporting build status back to GitLab for everybody without the need of defining individual credentials or API tokens. In other words, I'd like to avoid using users or admins credentials, personal API tokens or deploy keys/tokens.

I understand that considering that my admin application in GitLab has API and read_repository scopes, I should be able to do so with the client id and secret I have, but I cannot find the way to make it work.

My questions are:

  1. Do I need any additional scope on top of API and read_repository in my application in GitLab?
  2. In Jenkins, the GitLab connections option under Configure System asks me for an API token. What should I configure there if I don't have/want to use an admin personal API token? I understand the GitLab application should be able to generate (dynamically?) an API token for every logged user or impersonate him somehow via this authentication process.
  • Could you split this question into two? The Q&A currently contains at least two questions. It would help if you could create two new Q&A and refer to this one. In the meantime I will close this Q&A.
    – 030
    Dec 25, 2019 at 10:48