GitlabCICD技术----部署Linux虚拟机类型的gitlab-runner
GitlabCICD技术----部署Linux虚拟机类型的gitlab-runner
(1)在gitlab上打开配置ci的项目,然后依次找到【setting】-【CICD】-【Runner】-【Expand】
(4)-安装包
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# sudo curl -L --output /usr/local/bin/gitlab-runner % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 53.9M 100 53.9M 0 0 4908k 0 0:00:11 0:00:11 --:--:-- 6547k[root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(5)修改权限
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# sudo chmod +x /usr/local/bin/gitlab-runner[root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(6)创建Gitlab Runner用户
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash[root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(7)创建gitlab-runner软连接
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# ln -s /usr/local/bin/gitlab-runner /usr/bin/gitlab-runner[root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(8)执行安装命令
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runnerRuntime platform arch=amd64 os=linux pid=13278 revision=4b9e985a version=14.4.0[root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(9)启动gitlab-runner服务
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# sudo gitlab-runner startRuntime platform arch=amd64 os=linux pid=13488 revision=4b9e985a version=14.4.0[root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(10)注册gitlab-runner
命令如下
sudo gitlab-runner register --url --registration-token $REGISTRATION_TOKEN
这里需要将 $REGISTRATION_TOKEN 替换为具体的token值
token值通过如下位置复制
[root@iZbp1flzt6x7pxmxfhmxeeZ home]# sudo gitlab-runner register --url --registration-token E_6cz-D_o4jz6nP6rPtoRuntime platform arch=amd64 os=linux pid=15050 revision=4b9e985a version=14.4.0Running in system-mode.Enter the GitLab instance URL (for example, # 此处需要和上图中的URL一致Enter the registration token: # 此处直接回车[E_6cz-D_o4jz6nP6rPto]:Enter a description for the runner: # 描述,随便填[iZbp1flzt6x7pxmxfhmxeeZ]: aliyun_shellEnter tags for the runner (comma-separated): # 标签,后续CI中就是根据此处设置的标签选择runner,后面可继续修改aliyun_shell,172.22.27.162Registering runner... succeeded runner=E_6cz-D_Enter an executor: shell, ssh, virtualbox, custom, docker-ssh, parallels, docker+machine, docker-ssh+machine, kubernetes, docker: # 此处因为是在linux上安装的,所以选择shell类型shell Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded![root@iZbp1flzt6x7pxmxfhmxeeZ home]#
(11)刷新页面,如下表示注册成功
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~