gitlab–基础–4.2–CICD–runner–常用命令
1、systemctl
读取的配置是 /etc/systemd/system/gitlab-runner.service文件
# 启动
systemctl start gitlab-runner.service
# 停止
systemctl stop gitlab-runner.service
# 重启
systemctl restart gitlab-runner.service
# 查看状态
systemctl status gitlab-runner.service
2、gitlab-runner run
2.1、语法
USAGE:
gitlab-runner run [command options] [arguments...]
OPTIONS:
-c value, --config value 配置文件路径,.toml结尾
--listen-address value 端口
-n value, --service value 服务名称,默认是gitlab-runner
-d value, --working-directory value 工作目录,也就是从gitlab clone项目的目录,默认是当前目录
-u value, --user value 执行shell脚本所用的用户
--syslog
2.2、案例
使用/root/config.toml配置文件,root用户启动
sudo gitlab-runner run -c /root/config.toml -u root &
3、gitlab-runner
2.1、语法
[root@zhoufei ~]# gitlab-runner -help
NAME:
gitlab-runner - a GitLab Runner
USAGE:
gitlab-runner [global options] command [command options] [arguments...]
VERSION:
15.2.1 (32fc1585)
AUTHOR:
GitLab Inc. <support@gitlab.com>
COMMANDS:
exec execute a build locally
list 列出了保存在配置文件中的所有运行 Runner
run run multi runner service
register 默认交互模式下使用,非交互模式添加 --non-interactive
install 安装 gitlab-runner
uninstall 卸载 gitlab-runner
start 启动 gitlab-runner
stop 停止 gitlab-runner
restart 重启 gitlab-runner
status 获取服务状态
run-single start single runner
unregister 该命令使用GitLab取消已注册的runner。。
verify 检查注册的runner是否可以连接,但不验证GitLab服务是否正在使用runner
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
read-logs reads job logs from a file, used by kubernetes executor (internal)
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--cpuprofile value write cpu profile to file [$CPU_PROFILE]
--debug debug mode [$RUNNER_DEBUG]
--log-format value Choose log format (options: runner, text, json) [$LOG_FORMAT]
--log-level value, -l value Log level (options: debug, info, warn, error, fatal, panic) [$LOG_LEVEL]
--help, -h show help
--version, -v print the version