I have Jenkins users authenticated by OpenLDAP and also gitlab CE instance authenticated by the same OpenLDAP.

And all the three are running in three different docker containers in the same network.

I am trying to pre configure Jenkins and Gitlab so that they can be resolved globally in the container world.

I have Jenkins Gitlab plugin pre configured in Jenkins. To add Gitlab in the global configuration, a Gitlab API token is required to be added in Gitlab section along with the server URL for accessing all the resources of the Gitlab instance.

I am trying to do a curl operation from a Jenkins container to Gitlab using a user name and password to Gitlab requesting for Authorization code and a Private token for each a user as to be created in Gitlab. All the user authentication is happening using the OpenLDAP. For Gitlab to generate an Authorization code the user has to be created in Gitlab, which would not be happening if the users are authenticated using OpenLDAP.

My questions are:

  1. Is it necessary to configure Jenkins with Gitlab globally to have Jenkins complete access at Gitlab resources, since we would require to authenticate once again from each job on a project level?

  2. How to preconfigure a private token or personal access token in Gitlab from a docker container perspective to be persistent and to be shared with Jenkins when the container spins up for the first time?

  3. When Gitlab is authenticated using OpenLDAP, without the user previously signing in into Gitlab, is a user not created in Gitlab? How to generate an authorization code for a user in this case?

  • Why do you use both jenkins and gitlab?
    – 030
    Nov 24, 2017 at 23:14

1 Answer 1

  1. yes, it will need access to Gitlab API to report back Jenkins build status.
  2. You can create a service account in LDAP such as Jenkins which can be used to generate Gitlab API tokens and use it to preconfigure Jenkins.
  3. Same as point #2

For more info - https://docs.gitlab.com/ee/integration/jenkins.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.