极狐GitLab 正式推出面向 GitLab 老旧版本(12.x、13.x、14.x、15.x 等)免费用户的专业升级服务,点击查看详情
您需要 登录 才可以下载或查看,没有账号?注册
本帖最后由 胡睿智 于 2024-4-11 15:59 编辑
官方原文: GitLab Runner Configuring runners in GitLab Install GitLab Runner Configuring GitLab Runner Self-signed certificates or custom Certification Authorities Runners autoscale configuration The system services of GitLab Runner GitLab Runner commands Feature flags Registering runners Executors GitLab Runner monitoring
官方原文:
详细内容请参考:GitLab Runner
Runner执行流程
详细内容请参考: Install GitLab Runner
Runner的安装方式有以下几种
详细内容请参考:Install GitLab Runner using the official GitLab repositories
Installing GitLab Runner
Updating GitLab Runner
Manually download packages
有时候linux的skel目录会导致GitLab Runner出错,安装Runner时可将环境变量GITLAB_RUNNER_DISABLE_SKEL的值设置为true。例如:
# For Debian/Ubuntu/Mint export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E apt-get install gitlab-runner # For RHEL/CentOS/Fedora export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E yum install gitlab-runner
详细内容请参考: Configuring GitLab Runner
通过config.toml文件修改GitLab Runner的配置,详细内容请参考:Advanced configuration。
config.toml示例:
concurrent = 1 check_interval = 0 [session_server] session_timeout = 1800 [[runners]] name = "test-runner" url = "https://gitlab.com" token = "__REDACTED__" executor = "kubernetes" [runners.cache] [runners.cache.s3] [runners.cache.gcs] [runners.kubernetes] host = "http://localhost:9876/" bearer_token_overwrite_allowed = false image = "" namespace = "" namespace_overwrite_allowed = "" privileged = false service_account_overwrite_allowed = "" pod_annotations_overwrite_allowed = "" [runners.kubernetes.volumes]
主要有以下几个配置:
详细内容请参考:The global section
主要有三个配置:
用Helm Chart部署的Runner不支持[session_server]。详细内容请参考:The [session_server] section
每个[[runners]]定义一个Runner,详细内容请参考:The [[runners]] section
定义Docker容器参数,详细内容请参考:The [runners.docker] section
定义虚拟机并发参数,详细内容请参考:The [runners.parallels] section
定义VirtualBox参数,详细内容请参考:The [runners.virtualbox] section
定义SSH连接参数,详细内容请参考:The [runners.ssh] section
基于自动伸缩特性定义Docker Machine,详细内容请参考:The [runners.machine] section
自定义执行器配置,详细内容请参考:The [runners.custom] section
定义分布式缓存,详细内容请参考:The [runners.cache] section
定义k8s参数,详细内容请参考:The [runners.kubernetes] section
定义是否允许自定义构建目录,详细内容请参考:The [runners.custom_build_dir] section
定义作业监控,详细内容请参考:The [runners.referees] section
详细内容请参考:Self-signed certificates or custom Certification Authorities
使用自签证书连接GitLab服务器,详细内容请参考:Supported options for self-signed certificates targeting the GitLab server
这是一种更通用的方式,详细内容请参考:Trusting TLS certificates for Docker and Kubernetes executors
使用docker machine按需创建云上的主机、在这些主机上执行作业。详细内容请参考:Runners autoscale configuration
在AWS ECW上自动伸缩GitLab Runner
在AWS Fargate上自动伸缩GitLab CI
可覆盖默认的系统服务配置,如systemd、upstart。详细内容请参考:The system services of GitLab Runner
详细内容请参考:GitLab Runner commands
查看命令行帮助:
详细内容请参考:Registration-related commands
详细内容请参考:Service-related commands
详细内容请参考:Run-related commands
详细内容请参考:Internal commands
使用指定的环境变量启用或禁用特定功能,详细内容请参考:Feature flags
详细内容请参考:Registering runners
模板文件示例:
[[runners.kubernetes.volumes.empty_dir]] name = "empty_dir" mount_path = "/path/to/empty_dir" medium = "Memory"
执行器用于在不同的场景下执行作业,详细内容请参考:Executors
GitLab Runner通过内嵌HTTP服务器(默认端口是9252)的/metrics发布Prometheus指标,可被Prometheus或其它客户端抓取。详细内容请参考:GitLab Runner monitoring
使用道具 举报
11
5
59