linuxea:gitlab-ci/cd runner配置和安装(一)


假设已经安装好gitlab10.8.4,如果没有安装即可,操作系统centos7.5
gitlab ee安装:
https://about.gitlab.com/installation/#centos-7
gitlab ce安装:
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm/download.rpm

gitlab-ci/cd devops QQ群:693788292

GitLab Runner是用于运行作业并将结果发回给GitLab,它与GitLab CI一起使用,而GitLab CI是GitLab中包含的开源持续集成服务,用于协调作业。
gitlab runner可以在不同场景运行构建,如:docker,shell,virtualbox,k8s等,具体参考官网说明
官网参考:https://docs.gitlab.com/runner/
安装参考:https://docs.gitlab.com/runner/install/

I. runner安装

https://docs.gitlab.com/runner/install/linux-manually.html
[root@linuxea-VM-Node_10_10_240_145 ~]$ wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64

创建用户

[root@linuxea-VM-Node_10_10_240_145 ~]$ useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
[root@linuxea-VM-Node_10_10_240_145 ~]$ cd /usr/local/bin

开始安装

[root@linuxea-VM-Node_10_10_240_145 /usr/local/bin]$ ./gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
[root@linuxea-VM-Node_10_10_240_145 /usr/local/bin]$ gitlab-runner start

II. 开始配置runners

1,在gitlab项目中左侧设置settings-->CI/CD-->Runners settings

我们使用的是指定的runner

2,开始在客户端配置(拉代码端)

开始注册

[root@linuxea-VM-Node_10_10_240_145 /usr/local/bin]$ gitlab-runner register
Running in system-mode.                            
                                          
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
请输入gitlab-ci的网址   
http://10.10.240.146

Please enter the gitlab-ci token for this runner:
请输入gitlab-ci runner的标记
rwscgp4UritWx8r-go_4

Please enter the gitlab-ci description for this runner:
请输入gitlab-ci runner说明
[DS-VM-Node_10_10_240_145.dwhd.org]: linuxea-test
Please enter the gitlab-ci tags for this runner (comma separated):
请输入gitlab-ci runner标签
linuxea-test        
Whether to run untagged builds [true/false]:
是否运行未标记的版本:
[false]: true
Whether to lock the Runner to current project 
[true/false]:
是否将runner锁定到当前项目:
[true]: true
Registering runner... succeeded   注册成功                runner=rwscgp4U
Please enter the executor: virtualbox, docker+machine, docker-ssh+machine, kubernetes, shell, ssh, parallels, docker, docker-ssh:
请输入执行程序:virtualbox, docker+machine, docker-ssh+machine, kubernetes, shell, ssh, parallels, docker, docker-ssh:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 
注册成功
[root@linuxea-VM-Node_10_10_240_145 /usr/local/bin]$ 

在返回gitlab已经激活成功

0 分享

您可以选择一种方式赞助本站

支付宝扫码赞助

支付宝扫码赞助

日期: 2018-06-20分类: 持续集成

标签: Gitlab-ci/cd, 持续集成工具

发表评论