1.安装Docker
参考 https://docs.docker.com/install/linux/docker-ce/centos/
2.安装gitlab ci runner
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash
yum install gitlab-ci-multi-runner -y
查看是否运行正常
gitlab-ci-multi-runner status
![](https://img.haomeiwen.com/i15730794/1a519507c1957546.png)
3.gitlab-runner注册问题
首先登陆gitlab获取url和tocken
![](https://img.haomeiwen.com/i15730794/d35a3aaf21c93369.png)
![](https://img.haomeiwen.com/i15730794/9d55a681cdcb1f49.png)
[root@gitlab-ci ~]# gitlab-ci-multi-runner register
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.example.com/
Please enter the gitlab-ci token for this runner:
AvpQDzBCL66sYKyURChH
Please enter the gitlab-ci description for this runner:
[gitlab-ci]:
Please enter the gitlab-ci tags for this runner (comma separated):
test,demo
Whether to run untagged builds [true/false]:
[false]:
Whether to lock Runner to current project [true/false]:
[false]:
ERROR: Registering runner... failed runner=AvpQDzBC status=couldn't execute POST against https://gitlab.example.com/api/v4/runners: Post https://gitlab.example.com/api/v4/runners: x509: certificate signed by unknown authority
PANIC: Failed to register this runner. Perhaps you are having network problems
[root@gitlab-ci ~]#
证书签名错误,在网上找了许多办法还是不行,解决办法:
[root@gitlab-ci docker]# gitlab-runner register \
--non-interactive \
--tls-ca-file=/etc/gitlab/ssl/gitlab.example.com.crt \
--url "https://gitlab.example.com/" \
--registration-token "AvpQDzBCL66sYKyURChH" \
--executor "docker" \
--docker-image maven:latest \
--description "runner " \
--tag-list "run" \
--run-untagged \
--locked="false"
Running in system-mode.
Registering runner... succeeded runner=AvpQDzBC
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
注册成功,返回到gitlab已经是激活的状态。
![](https://img.haomeiwen.com/i15730794/1383c6252372222b.png)
注册问题参考
https://blog.csdn.net/qq_34206560/article/details/88802893
https://docs.gitlab.com/11.9/runner/register/index.html
网友评论