【问题标题】:GitLab CI runner with Docker executor fails to clone repository带有 Docker 执行器的 GitLab CI 运行器无法克隆存储库
【发布时间】: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


    【解决方案1】:

    在我机器上的 gitlab-runner 配置文件 (/etc/gitlab-runner/config.toml) 中为带有 docker executor 的运行器添加 clone_url 参数解决了我的问题(基于此 GitLab CI/CD forum post)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-30
      • 2013-11-21
      • 2019-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多