If we need to clone any other private repositories during the GitLab `ci` pipeline process, we can use the below command to run the on the `bash` script to copy the source code from another project.
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/myuser/mydependentrepo
It can also be used for system-wide authentication (only do this in a docker container, it will overwrite ~/.netrc):
echo -e "machine gitlab.com\nlogin gitlab-ci-token\npassword ${CI_JOB_TOKEN}" > ~/.netrc
Gitlab Source
No comments:
Post a Comment
Please post any queries and comments here.