我设置了 Gitlab 服务器并需要使用 gitlab-runner.exe 运行测试 Windows。
gitlab-runner 的执行器设置为shell
, the config.toml
好像
concurrent = 1
check_interval = 0
[[runners]]
name = "PC123"
url = "http://1.2.3.4/ci"
token = "cd2b093adc5ca09ea41ee4eadb0752"
executor = "shell"
[runners.cache]
当测试在提交上生成时,它会失败并显示
Cloning into 'C:/git/builds/ac70aeb9/0/test/myproject'...
fatal: unable to access 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@localhost/test/boundaries.git/': Failed to connect to localhost port 80: Connection refused
我想问题是 URL 中的主机名“localhost”,它指的是 gitlab-runner 所在的机器。当我一开始设置服务器时,我使用“localhost”作为服务器主机名。这可能不是最好的主意。 :)
与此同时,我更改了这个“localgit”,但 URL 没有调整,它仍然显示“localhost”。 (服务器重新启动,gitlab-runner 服务重新启动)。
难道服务器的主机名存储在我在主机名仍然存在时克隆的原始存储库中的某个位置localhost
? .git/config
显示正确的IP:
[remote "origin"]
url = http://1.2.3.4/test/myproject.git
我发现了另一个问题(GitLab 运行程序无法通过 http 克隆存储库)其中提到了一种将其他主机添加到 gitlab-runner 的方法config.toml
, like
[runners.docker]
extra_hosts = ["ci.mygitlab:127.0.0.1"]
但我必须使用shell
执行者,而不是docker。