GitLab不仅仅只是代码托管的工具,它还集成了CI的功能,通过Gitlab CI Multi Runner工具可以更方便的搭建持续集成环境。
在安装好GitLab之后还需要再安装一个叫gitlab-ci-multi-runner的工具。

root@localhost bin]# gitlab-ci-multi-runner register
Running in system-mode.                            
                                                   
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://192.168.175.129/
Please enter the gitlab-ci token for this runner:
7tDRCLBdsKaojWKdmPBo
Please enter the gitlab-ci description for this runner:
[localhost.localdomain]: vue-demo
Please enter the gitlab-ci tags for this runner (comma separated):
demo
Whether to run untagged builds [true/false]:
[false]: true
Whether to lock Runner to current project [true/false]:
[false]: true
ERROR: Registering runner... failed                 runner=7tDRCLBd status=couldn't execute POST against http://192.168.175.129/api/v4/runners: Post http://192.168.175.129/api/v4/runners: proxyconnect tcp: dial tcp: lookup http on 192.168.175.2:53: no such host
PANIC: Failed to register this runner. Perhaps you are having network problems 

解决方案:
参考:https://www.jianshu.com/p/fa71d97dcde0
因runner运行时的执行者是gitlab-runner账户,需要在gitlab-runner账号下设置访问https类网站时,免验证

git config --global http."sslVerify" false

然后就ok了

[root@localhost ~]# git config --global http."sslVerify" false
[root@localhost ~]# gitlab-ci-multi-runner status
gitlab-runner: Service is running!
[root@localhost ~]#  gitlab-runner register
Running in system-mode.                            
#输入您的GitLab实例URL:                                                   
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://192.168.175.xxx/
#输入您获得的令牌以注册Runner:
Please enter the gitlab-ci token for this runner:
Gvcpo9H8fMxSykFspvG6
#输入Runner的描述,您可以稍后在GitLab的UI中进行更改:
Please enter the gitlab-ci description for this runner:
[localhost.localdomain]: vue-demo
#输入与Runner关联的标签,您可以稍后在GitLab的UI中进行更改:
Please enter the gitlab-ci tags for this runner (comma separated):
vue-tag
#是否运行未加标签的构建
Whether to run untagged builds [true/false]:
[false]: true
#是否锁定当前项目Runner
Whether to lock Runner to current project [true/false]:
[false]: true
Registering runner... succeeded                     runner=Gvcpo9H8
#在这里需要输入runner的执行方式,因为我的Gitlab和runner是安装在同一台服务器上的,直接输入shell
Please enter the executor: docker+machine, docker-ssh+machine, docker, parallels, ssh, virtualbox, kubernetes, docker-ssh, shell:
shell
#出现这样信息表示服务端的配置就已经成功结束了,如果需要使用到自动构建,还需要再添加一个配置文件,下面说说这个。
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 

参考
Gitlab CI-3.遇到的问题

gitlab-runner 注册(register) — 同样的错误另外一种解决方案
gitlab-runner register 注册报错

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐