文章目录[隐藏]
GitLab Runner
运行gitlab CI/CD容器 分布式。可以运行在本地可以运行在服务端。可以是公共的也可以是私有的
安装GitLab Runner
Linux 安装
安装命令
Ubuntu
dpkg -i gitlab-runner_<arch>.deb
CentOS
rpm -i gitlab-runner_<arch>.rpm
windows 安装
安装命令
管理员权限运行cmd
.\gitlab-runner.exe install --user ENTER-YOUR-USERNAME --password ENTER-YOUR-PASSWORD
.\gitlab-runner.exe start
mac 安装
brew install gitlab-runner
# 启动
brew services start gitlab-runner
注册GitLab Runner
Linux 注册
sudo gitlab-runner start
sudo gitlab-runner register
windows 注册
.\gitlab-runner.exe start
./gitlab-runner.exe register
mac 注册
gitlab-runner register
- 输入gitlab的服务URL,这个使用的是https://gitlab.com/
- 输入gitlab-ci的Toekn,获取方式参考上图
- 关于集成服务中对于这个runner的描述
- 给这个gitlab-runner输入一个标记,这个tag非常重要,在后续的使用过程中需要使用这个tag来指定gitlab-runner
- 是否运行在没有tag的build上面。在配置gitlab-ci的时候,会有很多job,每个job可以通过tags属性来选择runner。这里为true表示如果job没有配置tags,也执行
- 是否锁定runner到当前项目
- 选择执行器,gitlab-runner实现了很多执行器,可用在不同场景中运行构建,详情可见GitLab Runner Executors,这里选用Shell模式
使用GitLab Runner
NAME:
gitlab-runner - a GitLab Runner
USAGE:
gitlab-runner [global options] command [command options] [arguments...]
VERSION:
13.0.0 (HEAD)
AUTHOR:
GitLab Inc. <support@gitlab.com>
COMMANDS:
exec execute a build locally(执行构建)
list List all configured runners(列出运行的事件)
run run multi runner service(运行管道服务)
register register a new runner(注册/取消注册)
install install service(安装)
uninstall uninstall service(卸载)
start start service(启动)
stop stop service(停止)
restart restart service(重启)
status get status of a service(状态)
run-single start single runner
unregister unregister specific runner
verify verify all registered runners
artifacts-downloader download and extract build artifacts (internal)
artifacts-uploader create and upload build artifacts (internal)
cache-archiver create and upload cache artifacts (internal)
cache-extractor download and extract cache artifacts (internal)
cache-init changed permissions for cache paths (internal)
health-check check health for a specific address
help, h Shows a list of commands or help for one command