Gitlab-ci runner是Gitlab-ci的运行环境,可以选择docker部署,也可以选择服务器进行部署。
Runner分为三种:specific runner、share runner、group runner
specific runner:个人runner,只可以自己种,在同一个项目组的人无法使用。自己通过specific runner的token进行创建个人的runner环境。
share runner和group runner 都是群组内人员共享。所有人都可以用。当CI运行错误时,会给提交人发送邮件。
Install Runner:
# For Debian/Ubuntu/Mint
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
sudo apt-get install gitlab-runner
然后进行Registering Runner
在gitlab-ci的setting中,选择ci
group runner只有在群组管理员权限才可以设置。
在 specific runner下面,会有runner的url和token。
然后进行runner的注册:
1.Run the following command:
sudo gitlab-runner register
2.Enter your GitLab instance URL:
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
3.Enter the token you obtained to register the Runner:
Please enter the gitlab-ci token for this runner
xxx
4.Enter a description for the Runner, you can change this later in GitLab's UI:
Please enter the gitlab-ci description for this runner
[hostame] my-runner
4.Enter the tags associated with the Runner, you can change this later in GitLab's UI: tag是用来在.gitlab-ci.yml中去指定用哪一个runner去运行
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
5.Enter the Runner executor:
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:docker
7.If you chose Docker as your executor, you'll be asked for the default image to be used for projects that do not define one in .gitlab-ci.yml:
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
Runner executor,因为我用shell脚本,我只用了shell这一种。
这样runner就在服务器装好了,就可以在配置ci文件中去指定runner运行了。
更多参照于官网:GitLab Runner | GitLab