2

I have two GitLab repository, both of them are under my username in GitLab. Both of them are private. One repository is a dependency of the other, but the latter one don't use submodule. Instead, it install the package to the docker image.

I have read this. But, I don't want to configure any token or other complex thing.

Is there any easy and friendly way to make my private repo transparent to myself?

Audra Jacot
  • 139
  • 7

1 Answers1

1

Check CI_JOB_TOKEN, It is one the predefined environment variables of GitLab CI/CD which can be used without any specification needed. Base on official documents CI_JOB_TOKEN is described as follows:

Token used for authenticating with the GitLab Container Registry and downloading dependent repositories

And base on this document:

The Job environment variable CI_JOB_TOKEN can be used to authenticate any clones of dependent repositories. For example:

git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/<user>/<mydependentrepo>.git

So you can clone your dependent repository into the current pipeline by using above code in the script part of every job you want in gitlab-ci.yml file.
It works fine whether it uses CI_JOB_TOKEN instead of your password or any tokens and there is no need to worry about gitlab-ci-token in the URL. You can also put every desired user name instead of it.

Amir Dadkhah
  • 1,074
  • 2
  • 11
  • 17