在centos中安装并注册gitlab runner |
您所在的位置:网站首页 › runner官网 › 在centos中安装并注册gitlab runner |
注册runner 有几种不同的方式,这里介绍的是在centos7中使用 rpm包来安装 按照gitlab runner的官网链接里面的介绍: gitlab runner 链接 下载官网描述: ## Replace ${arch} with any of the supported architectures, e.g. amd64, arm, arm64 # A full list of architectures can be found here https://gitlab-runner-downloads.s3.amazonaws.com/latest/index.html curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_${arch}.rpm"如官网所描述,将${arch}替换成所支持的文件 curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm"这里是将${arch}换成了amd64 在centos7中新建一个runner的文件夹,在该目录下输入上述命令。当下载完之后,即可看见在当前的runner文件夹中有gitlab-runner_amd64.rpm文件了 如官网所描述,运行下面的命令
运行如下命令,注意一些关键参数的意思 url: 所管理gitlab 服务的域名registration-token: 注册runner的token. 一般是owner权限可以在gitlab runner信息中查看到executor: 执行器的类别,有很多,常用的有docker和shell,这里我们选择shell类型的执行器description: 对注册runner的描述tag-list: 注册runner的标签run-untagged:对没有标签的流水线是否可以使用当前的runner sudo gitlab-runner register \ --non-interactive \ --url "https://gitlab.dc.servyou-it.com/" \ --registration-token "gitlab token" \ --executor "shell" \ --docker-image alpine:latest \ --description "afe-shell-runner" \ --tag-list "tag" \ --run-untagged="true" \ --locked="false" \ --access-level="not_protected"注册完之后即可看到,已近显示注册成功了,并且可以在/etc/gitlab-runner/config.toml配置文件中查看到注册runner的基本信息 也可以去gitlab网站中查看我们刚刚注册的runner 我们可以写一个简单的流水线,输出一些内容。发现此时的runner可以正常运行了 我们可以注册多个runner,也可以删除指定的runner。 这里我们使用gitlab-runner list查看到有一个runner的名称为afe-shell-runner. 我们通过下面命令将其删除 gitlab-runner verify --delete --name afe-shell-runner显示runner…is removed之后该runner已近被删除了。 我们可以通过gitlab-runner list命令查看到已近没有afe-she-runner了。 也可以查看config.toml配置文件发现也没有了afe-she-runner的信息了 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |