从 gitlab CI 下载另一个具有相同作者的私有存储库
Download another private repository from gitlab CI with same author
我有两个 GitLab 存储库,它们都在我在 GitLab 中的用户名下。他们两个都是私人的。一个存储库是另一个存储库的依赖项,但后者不使用子模块。相反,它将包安装到 docker 图像。
我已阅读this。但是,我不想配置任何令牌或其他复杂的东西。
有什么简单友好的方法可以让我的私人仓库对我自己透明吗?
勾选CI_JOB_TOKEN
,是predefined environment variables of GitLab CI/CD which can be used without any specification needed. Base on official documentsCI_JOB_TOKEN
中的一个,说明如下:
Token used for authenticating with the GitLab Container Registry and downloading dependent repositories
并基于此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
因此,您可以通过在 gitlab-ci.yml
文件中您想要的每个作业的脚本部分使用上述代码,将您的依赖存储库克隆到当前管道中。
它工作正常它是否使用 CI_JOB_TOKEN
而不是您的密码或任何令牌,并且无需担心 URL 中的 gitlab-ci-token
。您也可以输入每个所需的用户名而不是它。
我有两个 GitLab 存储库,它们都在我在 GitLab 中的用户名下。他们两个都是私人的。一个存储库是另一个存储库的依赖项,但后者不使用子模块。相反,它将包安装到 docker 图像。
我已阅读this。但是,我不想配置任何令牌或其他复杂的东西。
有什么简单友好的方法可以让我的私人仓库对我自己透明吗?
勾选CI_JOB_TOKEN
,是predefined environment variables of GitLab CI/CD which can be used without any specification needed. Base on official documentsCI_JOB_TOKEN
中的一个,说明如下:
Token used for authenticating with the GitLab Container Registry and downloading dependent repositories
并基于此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
因此,您可以通过在 gitlab-ci.yml
文件中您想要的每个作业的脚本部分使用上述代码,将您的依赖存储库克隆到当前管道中。
它工作正常它是否使用 CI_JOB_TOKEN
而不是您的密码或任何令牌,并且无需担心 URL 中的 gitlab-ci-token
。您也可以输入每个所需的用户名而不是它。