gitlab - Runner 无法克隆 gitlab 存储库

标签 gitlab runner

我的机器上安装的运行程序无法克隆 git 存储库。

我有一个以 dockerized 方式运行的 gitlab 实例,并公开对 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并且可以做到。

共享运行者已禁用,我注册了唯一的运行者。

enter image description here

我在另一台计算机上注册并安装了运行器,试图创建一个简单的 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 上,因此运行程序无法克隆。 我可以尝试别的吗?

最佳答案

终于找到解决办法了。 在此页面中阅读有关高级运行者配置的信息 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 = ""

关于gitlab - Runner 无法克隆 gitlab 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57188859/

相关文章:

docker - 将 Docker 镜像从 Gitlab 的私有(private) Docker 注册表部署到 Openshift

ssl - GitLab SSL 证书错误 : No account exists

c# - 从蛋糕脚本中将警告消息记录在文本文件中

html - 从 0.9.2 更新到 0.9.5 后出现错误 "java.lang.IllegalArgumentException: Illegal group reference"

java - 如何从类方法中重复创建 Jlabel addText?

java - Cucumber Java Maven - ExtendedCucumberOptions - 功能缺少步骤

Gitlab 多跑者

git - 使用 GitLab 页面托管静态网站

docker - 使用docker-compose将Gitlab CI/CD移植到Digital Ocean以获取多个存储库

ubuntu - gitlab ssh runner 失败。怎么了?