【发布时间】:2022-11-10 19:14:53
【问题描述】:
我想在我机构的 GitLab 实例上使用 GitLab CI 来为我的 Python 项目运行单元测试。
我在.gitlab-ci.yml 文件中写了一个简单的工作:
test-job:
stage: test
script:
- echo "This job tests something"
我已经在我的机器上用 Shell executor 定义了一个 first runner。
在 GitLab 实例存储库上推送新提交时,该作业使用第一个运行程序成功运行。
我还在本地成功地运行了这项工作:sudo gitlab-runner exec shell test-job
然后我用 Docker 执行器定义了第二个运行器(并在 GitLab 实例上暂停了第一个运行器)。
我还在我的.gitlab-ci.yml 文件中的stage: test 之前添加了image: continuumio/miniconda3。
推送到远程仓库时,第二个运行者的作业失败,并返回以下错误:
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See http://gitlab2.xxx.xx/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'http://gitlab2.xxx.xx/xxx/xxx.git/'
我成功地在本地运行了这项工作:sudo gitlab-runner exec docker test-job
推送到 GitLab 实例时使用 Docker 执行程序运行此测试我做错了什么?
我应该添加变量来存储凭据并访问 GitLab 实例吗?在那种情况下,Shell runner 是如何成功的?
【问题讨论】:
标签: git docker gitlab-ci gitlab-ci-runner