Globally configuring Gitlab with Jenkins in docker container environment 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:


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?
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?
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?
yes, it will need access to Gitlab API to report back Jenkins build status.
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.
Same as point #2


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