【问题标题】:Runner cannot clone gitlab repositoryRunner 无法克隆 gitlab 存储库
【发布时间】:2019-12-02 22:59:49
【问题描述】:

我机器上安装的运行器无法克隆 git 仓库。

我有一个 gitlab 实例,它作为 dockerized 运行,并在http://172.19.193.16:666 地址公开了对 Web 界面的访问。在 80 端口运行另一个完全不同的网页。

Gitlab 建议用这个 url http://c87aa950bc8a/yamil.ortega/aprendizajegit.git 克隆代码 但我改成http://172.19.193.16:666/yamil.ortega/aprendizajegit.git 可以了。

共享跑步者被禁用,我只注册了这个跑步者。

我在另一台计算机上注册并安装了运行器,试图制作一个简单的 CI 管道。我的 toml 文件是这样的。

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "RunnerParaDotNet"
  url = "http://http://172.19.193.16:666/"
  token = "JTJxZ_xcxnzbs89Vcq_x"
  executor = "shell"
  shell = "powershell"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.custom]
    run_exec = ""

当我添加一个新管道并且运行器运行时,我收到以下消息

Running with gitlab-runner 12.1.0 (de7731dd)
  on RunnerParaDotNet JTJxZ_xc
Using Shell executor...
Running on CTISMXL8310VN7...
Fetching changes...
Reinitialized existing Git repository in C:/GitLab-Runner/builds/JTJxZ_xc/0/yamil.ortega/aprendizajegit/.git/
fatal: unable to access 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@c87aa950bc8a/yamil.ortega/aprendizajegit.git/': Could not resolve host: c87aa950bc8a
ERROR: Job failed: exit status 1

我加了一行

172.19.193.16        c87aa950bc8a

到我在 C:\Windows\System32\drivers\etc 中的主机文件,现在我收到了这个错误。

Running with gitlab-runner 12.1.0 (de7731dd)
  on RunnerParaDotNet JTJxZ_xc
Using Shell executor...
Running on CTISMXL8310VN7...
Fetching changes...
Reinitialized existing Git repository in C:/GitLab-Runner/builds/JTJxZ_xc/0/yamil.ortega/aprendizajegit/.git/
fatal: repository 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@c87aa950bc8a/yamil.ortega/aprendizajegit.git/' not found
ERROR: Job failed: exit status 1

所以,我知道我可以使用别名 c87aa950bc8a 联系 Gitlab 服务器(修改主机文件),但由于它位于端口 666 上,因此运行器无法克隆。 我可以试试别的吗?

【问题讨论】:

    标签: gitlab runner


    【解决方案1】:

    终于找到了解决办法。 在此页面中阅读有关高级运行器配置的信息 https://docs.gitlab.com/runner/configuration/advanced-configuration.html

    发现我必须添加

    clone_url 
    

    config.toml 文件说明

    所以,mi config.toml 文件看起来像这样

    concurrent = 1
    check_interval = 0
    
    [session_server]
    session_timeout = 1800
    
    [[runners]]
      name = "RunnerParaDotNet"
      url = "http://172.19.193.16:666/"
      token = "JTJxZ_xcxnzbs89Vcq_x"
      executor = "shell"
      shell = "powershell"
      clone_url = "http://172.19.193.16:666/"
    [runners.custom_build_dir]
    [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.custom]
    run_exec = ""
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-17
      相关资源
      最近更新 更多