Gitlab CI - 注册跑步者失败
Gitlab CI - Failed to register runner
我已经从源代码安装了我的 gitlab,使用 letsencrypt 对其进行保护并将其部署在 https://gitlab.mydomain.com
下。我可以访问该网站并创建存储库等,但我找不到注册 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
我的 gitlab 系统运行良好,我真的 运行 无法解释为什么会有 connection reset by peer
。当我尝试直接从错误消息中卷曲地址时,它 returns 是一个正确的响应。
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
将 gitlab 更新为 8.8.3
并将 gitlab-multi-ci-runner
更新为最新版本后问题消失了。
我也从头开始了我的gitlab nginx配置文件。
最后我也分不清到底是哪一个改动解决了问题。
到目前为止,我有很多错误和问题,从错误 404、403 开始,到 post 请求的问题结束。
对我来说,问题似乎是 incompatibility between GitLab and ci-runner。
与 post 问题相同的解决方案是安装旧版本的 ci-runner:
sudo apt install gitlab-ci-multi-runner=1.11.1
我已经通过安装gitlab-ci-multi-runner=1.11.1
解决了这个问题。
如果 runner 和 gitlab 运行 在同一台主机上,您可以通过输入以下第一个问题而不是文档中给出的内容来解决此问题:
http://gitlab:port
其中gitlab是容器名称,port是容器的左端口号。如果您使用的是 gitlab 内部 ssl 证书,请指定 https 而不是 http。这总是在我得到它时解决这个问题。
对于正在使用 docker 的用户:
问题是关于 docker 网络的。
如果你尝试
"$docker container inspect $id"
你会看到gitlab容器的IP地址。
在第一个问题中指向该 ip 地址即可正常工作。
我已经从源代码安装了我的 gitlab,使用 letsencrypt 对其进行保护并将其部署在 https://gitlab.mydomain.com
下。我可以访问该网站并创建存储库等,但我找不到注册 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
我的 gitlab 系统运行良好,我真的 运行 无法解释为什么会有 connection reset by peer
。当我尝试直接从错误消息中卷曲地址时,它 returns 是一个正确的响应。
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
将 gitlab 更新为 8.8.3
并将 gitlab-multi-ci-runner
更新为最新版本后问题消失了。
我也从头开始了我的gitlab nginx配置文件。
最后我也分不清到底是哪一个改动解决了问题。
到目前为止,我有很多错误和问题,从错误 404、403 开始,到 post 请求的问题结束。
对我来说,问题似乎是 incompatibility between GitLab and ci-runner。
与 post 问题相同的解决方案是安装旧版本的 ci-runner:
sudo apt install gitlab-ci-multi-runner=1.11.1
我已经通过安装gitlab-ci-multi-runner=1.11.1
解决了这个问题。
如果 runner 和 gitlab 运行 在同一台主机上,您可以通过输入以下第一个问题而不是文档中给出的内容来解决此问题:
http://gitlab:port
其中gitlab是容器名称,port是容器的左端口号。如果您使用的是 gitlab 内部 ssl 证书,请指定 https 而不是 http。这总是在我得到它时解决这个问题。
对于正在使用 docker 的用户:
问题是关于 docker 网络的。
如果你尝试
"$docker container inspect $id"
你会看到gitlab容器的IP地址。
在第一个问题中指向该 ip 地址即可正常工作。