2

我想在单独的服务器上安装 GitLab Runner,但是当我尝试连接到 GitLab 时,我收到:

Running in system-mode.                            

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
<URL>
Please enter the gitlab-ci token for this runner:
<TOKEN>       
Please enter the gitlab-ci description for this runner:
[<url>]: <description>
Please enter the gitlab-ci tags for this runner (comma separated):

Whether to lock Runner to current project [true/false]:
[false]: 
ERROR: Registering runner... failed                 runner=<runner-token> status=couldn't execute POST against <url>/api/v4/runners: Post <url>/api/v4/runners: dial tcp 172.17.0.2:80: getsockopt: connection refused
ERROR: Checking GitLab compatibility... not-compatible  reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1 runner=<runner-token> statusText=couldn't execute POST against <url>/api/v4/runners/verify: Post <url>/api/v4/runners/verify: dial tcp 172.17.0.2:80: getsockopt: connection refused
PANIC: Failed to register this runner. Perhaps you are having network problems 

如果我从 POSTMAN 创建 POST 请求,我可以创建跑步者,但是当我从 gitlab-ci 尝试时,我不能。你知道出了什么问题吗?我们的Gitlab在另一台服务器上,我想把Gitlab和Gitlab-ci分开。我希望 Gitlab-CI 在单独的服务器上,而不是在 Gitlab 所在的同一台服务器上。怎么做,你知道吗?

4

2 回答 2

0

是的,我解决了我的问题。问题出在哪里:我创建了 docker-compose.yml 文件,它看起来像这样:

web:
  image: 'gitlab/gitlab-runner:latest'
  restart: always
  hostname: domain
  container_name: gitlab-runner
  volumes:
    - '/storage/gitlab-runner/gitlab-runner/config:/etc/gitlab-runner'
    - '/var/run/docker.sock:/var/run/docker.sock

但是,当我尝试连接 gitlab 和 gitlab ci 时,我在这一行看到: Please enter the gitlab-ci description for this runner: [<url>]: <description> 我收到了[<url>],但我必须接收随机令牌与 url。然后我决定删除hostname: domain并重新开始该过程。然后一切正常。所以我的新docker-compose.yml文件看起来像:

web:
  image: 'gitlab/gitlab-runner:latest'
  restart: always
  container_name: gitlab-runner
  volumes:
    - '/storage/gitlab-runner/gitlab-runner/config:/etc/gitlab-runner'
    - '/var/run/docker.sock:/var/run/docker.sock

现在一切正常。

于 2017-06-09T11:36:57.067 回答
0

您的问题有两个可能的原因:

  1. 版本不匹配:可能您的跑步者与您的 GitLab 版本不兼容,如消息中所述:ERROR: Checking GitLab compatibility... not-compatible reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1. 检查您的 GitLab 实例版本并确保您的运行器版本与其兼容。

    Runners 9.0 及以上版本使用新的 v4 API,至少需要 GitLab 9.0。

  2. 网络问题:由于某些网络限制或某些阻塞,您的 Gitlab Runner 无法访问 GitLab 服务器。发生这种情况时,将显示与上面相同的错误消息。尝试<url>/api/v4/runners/verify从 GitLab Runner 服务器 curl 以了解这是否是问题所在。

于 2017-06-02T15:26:45.790 回答