一、添加yum源
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
二、安裝gitlab-runner
yum install gitlab-runner -y
三、配置gitlab-runner
向GitLab-CI註冊一個Runner需要兩樣東西:GitLab-CI的url和註冊token。
其中,token是爲了確定你這個Runner是所有工程都能夠使用的Shared Runner還是具體某一個工程才能使用的Specific Runner。
如果要註冊Shared Runner,你需要到管理界面的Runners頁面裏面去找註冊token。
[root@dx-cdh3 cmdb]# gitlab-runner register
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://gitlab.clife.cn/
Please enter the gitlab-ci token for this runner:
jmGuf9k2WsssNaxsBGcnJ6T
Please enter the gitlab-ci description for this runner:
[dx-cdh3]: share_runner
Please enter the gitlab-ci tags for this runner (comma separated):
Registering runner... succeeded runner=jmGuf9k2
Please enter the executor: shell, virtualbox, docker+machine, docker-ssh+machine, kubernetes, docker, docker-ssh, parallels, ssh:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
四、如果需要使用docker構建服務跟發佈,添加用戶到docker用戶組
usermod -a -G docker gitlab-runner