CentOS下gitlab-runner安装及注册

一、gitlab-runner 安装

         curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash

         sudo yum install gitlab-runner

        (参照官网地址:https://docs.gitlab.com/runner/install/linux-repository.html)

二、注册全局gitlab-runner到gitlab服务器

1、登录gitlab管理页面,进入管理中心 -> 概述 -> Runners页面,获取Gitlab 注册令牌。如下:

CentOS下gitlab-runner安装及注册_第1张图片

2、在gitlab-runner服务器执行命令注册runner

(1)运行以下命令:

gitlab-runner register

(2)输入您的GitLab实例URL(参照gitlab)

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com ):

http://11.1.14.145/

(3)输入您获得的令牌以注册Runner(参照gitlab)

Please enter the gitlab-ci token for this runner:

xxxxxxxxxxxxxxxxxxxxxxxxxxx

(4)输入Runner的描述,您可以稍后在GitLab的UI中更改:

Please enter the gitlab-ci description for this runner:

[hostame] my-runner

(5)输入与Runner关联的标签,您可以稍后在GitLab的UI中更改:

Please enter the gitlab-ci tags for this runner (comma separated):

my-tag,another-tag

(6)输入Runner执行程序:

Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:

shell

注册成功后,会在gitab管理中心 -> 概述 -> Runners页面看到注册的runner信息。

 

备注

什么情况下需要注册Shared Runner?

  1. 比如,GitLab上面所有的工程都有可能需要在公司的服务器上进行编译、测试、部署等工作,这个时候注册一个Shared Runner供所有工程使用就很合适。

什么情况下需要注册Specific Runner?

  1. 比如,我可能需要在我个人的电脑或者服务器上自动构建我参与的某个工程,这个时候注册一个Specific Runner就很合适。


 

你可能感兴趣的:(CentOS下gitlab-runner安装及注册)