gitlab之安装gitlab-runner
如何搞gitrunner
1.安装
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
sudo yum install gitlab-runner
2.注册
sudo gitlab-runner register
然后,按照提示操作:
输入 GitLab 实例的 URL。
输入从 GitLab 获取的注册令牌。
输入 Runner 的描述。
输入 Runner 的标签(可选)。
选择 Runner 的执行器(例如 shell, docker 等)-----》写shell
# 启动
sudo gitlab-runner start
3.去把配置文件拷贝过来
/etc/gitlab-runner/config.toml
例子
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "csjsxxx-cdn-dev"
url = "https://gitlab.xxxi.com/"
id = 1
token = "e4uD46EFxxxMPn1"
token_obtained_at = 2023-05-13T07:24:52Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "shell"
builds_dir = "/data/wwwroot/"
[runners.custom_build_dir]
enabled = true
[runners.cache]
MaxUploadedArchiveSize = 0
4.创建gitlab-runner用户
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
5.给目录修改权限
chown -R gitlab-runner:gitlab-runner /data/wwwroot/
6.等待查看流水线执行成功