在 CentOS 上启动 gitlab-runner 注册失败

Failed to start gitlab-runner register on CentOS

我已经在 CentOS 机器上安装了 gitlab-runner,但是在注册步骤中失败并显示“connection refused”:

sudo /usr/local/bin/gitlab-runner register --non-interactive --url "https://%myGitlab%/" --registration-token "%myToken%" --executor "shell" --description "TestServerRunner" --tag-list "TestRunner, CIOnTest"
Runtime platform                                    arch=amd64 os=linux pid=3149 revision=4b9e985a version=14.4.0
Running in system-mode.

ERROR: Registering runner... failed                 runner=yoqL_Qsh status=couldn't execute POST against https://%myGitlab%/api/v4/runners: Post https://%myGitlab%/api/v4/runners: dial tcp %myGitlabIp%:443: connect: **connection refused**
PANIC: Failed to register the runner. You may be having network problems.

但是,如果我尝试连接到 gitlab.com,它会打印出正常的 'error' - 错误的标记:

sudo /usr/local/bin/gitlab-runner register --non-interactive --url "https://gitlab.com/" --registration-token "%myToken%" --executor "shell" --description "TestServerRunner" --tag-list "TestRunner, CIOnTest"
Runtime platform                                    arch=amd64 os=linux pid=8259 revision=4b9e985a version=14.4.0
Running in system-mode.

ERROR: Registering runner... forbidden (check registration token)  runner=yoqL_Qsh
PANIC: Failed to register the runner. You may be having network problems.

可能出了什么问题? Ping 到 %MyGitlabIp% 存在。

这将是与您的 运行ner 机器和 gitlab 实例之间的连接有关的网络相关错误。虽然 ping 实例可能正常工作,但 ICMP (ping) 流量使用与 HTTPS 流量不同的端口和协议。如果您尝试从您的框中 运行 curl https://<my instance domain>,您可能会收到错误消息。你应该检查你的自托管 gitlab 实例上的防火墙规则。

这听起来好像是通过在 运行 自托管 gitlab 实例的机器上打开防火墙规则来解决的。