简体   繁体   English

Gitlab CI - 无法注册跑步者

[英]Gitlab CI - Failed to register runner

I've setup my gitlab installation from source, secured it with letsencrypt and deployed it under https://gitlab.mydomain.com .我已经从源代码设置了我的 gitlab 安装,使用 letencrypt 保护它并在https://gitlab.mydomain.com下部署它。 I can access the website and create repositories, etc. but I can't find a way to register a gitlab ci runner for the installation.我可以访问网站并创建存储库等,但我找不到为安装注册 gitlab ci runner 的方法。

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
https://gitlab.mydomain.com/ci
Please enter the gitlab-ci token for this runner:
xxxxxxxx-xxxxxxxx
Please enter the gitlab-ci description for this runner:
[server]: test
Please enter the gitlab-ci tags for this runner (comma separated):
test
ERROR: Registering runner... failed     runner=xxxxxxx 
status=couldn't execute POST against https://gitlab.mydomain.com/ci/api/v1/runners/register.json:
Post https://gitlab.mydomain.com/ci/api/v1/runners/register.json: 
read tcp [ipv6address]:33518->[ipv6address]:443: read: connection reset by peer
PANIC: Failed to register this runner. Perhaps you are having network problems

My gitlab system is working fine and I really ran out of explanations why there would be a connection reset by peer .我的 gitlab 系统工作正常,我真的没有解释为什么会有connection reset by peer When I try to curl the address from the error message directly, it returns a correct response.当我尝试直接从错误消息中卷曲地址时,它返回正确的响应。

curl -v https://gitlab.mydomain.com/ci/api/v1/runners/register.json
*   Trying ipv6address...
* Connected to gitlab.mydomain.com (ipv6address) port 443 (#0)
* found 174 certificates in /etc/ssl/certs/ca-certificates.crt
* found 700 certificates in /etc/ssl/certs
* ALPN, offering h2
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_256_GCM_SHA384
*        server certificate verification OK
*        server certificate status verification SKIPPED
*        common name: mydomain.com (matched)
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: CN=mydomain.com
*        start date: Wed, 18 May 2016 14:35:00 GMT
*        expire date: Tue, 16 Aug 2016 14:35:00 GMT
*            issuer: C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3
*        compression: NULL
* ALPN, server did not agree to a protocol
> GET /ci/api/v1/runners/register.json HTTP/1.1
> Host: gitlab.mydomain.com
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 405 Method Not Allowed
< Server: nginx
< Date: Sun, 29 May 2016 09:14:09 GMT
< Content-Type: application/json
< Content-Length: 2
< Connection: keep-alive
< Allow: OPTIONS, POST
< Cache-Control: no-cache
< Status: 405 Method Not Allowed

If the runner and gitlab are running on the same host you can get around this problem by entering a the first question the following instead what is given in the docs:如果 runner 和 gitlab 在同一主机上运行,​​您可以通过输入第一个问题而不是文档中给出的内容来解决此问题:

http://gitlab:port

where gitlab is the container name and port the left port number of the container.其中gitlab是容器名称, port是容器的左侧端口号。 If you are using gitlab internal ssl certs you specify https instead of http.如果您使用 gitlab 内部 ssl 证书,请指定 https 而不是 http。 This always solves this problem when I get it.当我得到它时,这总是可以解决这个问题。

Problem went away after updating gitlab to 8.8.3 and gitlab-multi-ci-runner to the most recent version.将 gitlab 更新到8.8.3并将gitlab-multi-ci-runner到最新版本后,问题就消失了。

I also started my gitlab nginx configuration files from scratch.我还从头开始了我的 gitlab nginx 配置文件。

In the end, I can't tell which change exactly solved the problem.最后,我不知道哪个更改完全解决了问题。

I had so far many errors and issue starting with Error 404, 403 and endings with problem with post request.到目前为止,我遇到了很多错误和问题,从错误 404、403 开始​​,以发布请求问题结束。

For me, problem seems to be incompatibility between GitLab and ci-runner .对我来说,问题似乎是GitLab 和 ci-runner 之间的不兼容

Solution, same on post issue, was install older version of ci-runner:解决方案,与 post 问题相同,是安装旧版本的 ci-runner:

sudo apt install gitlab-ci-multi-runner=1.11.1

我已经通过安装gitlab-ci-multi-runner=1.11.1解决了它。

For those that are using docker:对于那些使用 docker 的人:

The issue its about docker network.这个问题是关于 docker 网络的。

If you try如果你尝试

  "$docker container inspect $id"

You are going to see the IPAddress of gitlab container.您将看到 gitlab 容器的 IPAddress。

Point to that ip adress on first question to works fine.在第一个问题中指向那个 ip 地址可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM