如何在 Debian 上安装运行极狐GitLab Runner?【二】

极狐GitLab 是 GitLab 在中国的发行版,专门面向中国程序员和企业提供企业级一体化 DevOps 平台,用来帮助用户实现需求管理、源代码托管、CI/CD、安全合规,而且所有的操作都是在一个平台上进行,省事省心省钱。可以一键安装极狐GitLab,详情可以参考极狐GitLab 下载安装官网

GitLab 中文版学习资料

关联阅读

上一篇文章中,我们演示了如何在 Debian 上通过安装包安装极狐GitLab Runner,本篇文章,我们演示用 docker 的方式在 Debian 上安装运行极狐GitLab Runner。

用容器的方式安装

首先要确保有 docker环境。用 info或 version查看即可:

复制代码
docker version
Client: Docker Engine - Community
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:18:01 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:18:01 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

创建 Runner

使用如下命令创建一个 Runner:

复制代码
$ docker run -d --name debian-gitlab-runner --restart always   -v $PWD:/etc/gitlab-runner    gitlab/gitlab-runner:latest

查看创建成功的容器:

复制代码
$ docker ps
CONTAINER ID   IMAGE                         COMMAND                  CREATED          STATUS          PORTS     NAMES
5dfe6ca004bc   gitlab/gitlab-runner:latest   "/usr/bin/dumb-init ..."   36 seconds ago   Up 35 seconds             debian-gitlab-runner

注册 Runner

同样使用前面的方法创建 Runner token,并使用如下命令注册 Runner:

复制代码
$ gitlab-runner register
Runtime platform                                    arch=amd64 os=linux pid=30 revision=81ab07f6 version=16.10.0
Running in system-mode.

Enter the GitLab instance URL (for example, https://gitlab.com/):
https://jihulab.com
Enter the registration token:
GR1348941xBNuxxxR1EvA4XjbqSz
Enter a description for the runner:
[5dfe6ca004bc]: docker-runner
Enter tags for the runner (comma-separated):
debina,docker
Enter optional maintenance note for the runner:
debian installation runner
WARNING: Support for registration tokens and runner parameters in the 'register' command has been deprecated in GitLab Runner 15.6 and will be replaced with support for authentication tokens. For more information, see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow
Registering runner... succeeded                     runner=GR1348941xBNuGoeh
Enter an executor: docker-autoscaler, instance, custom, shell, ssh, parallels, docker+machine, kubernetes, virtualbox, docker, docker-windows:
docker
Enter the default Docker image (for example, ruby:2.7):
alpine:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml"

同样可以在 Runner 界面上看到注册成功的 Runner:

测试 Runner

用同样的项目,测试一下 Runner。

从最顶部的 log 看使用的是用 docker 安装的 Runner 运行的此次 CI/CD。

相关推荐
wangruofeng3 小时前
git-filter-repo 把 .git 从 112MB 砍到 1.4MB,但漏推 tag 让 clone 又胖回来
github·devops
AOwhisky11 小时前
云原生 DevOps 工具链从入门到实战(第一期)——DevOps概述与GitLab部署——从理念到工具落地
运维·ci/cd·云原生·gitlab·开发·devops
2301_7736436211 小时前
1.SDLC 与模型(简述)
ci/cd
lbb 小魔仙1 天前
Git + Python 项目工作流最佳实践:pre-commit、CI、CHANGELOG 自动化
git·python·ci/cd
Geek-Chow1 天前
08 Inside the Collector: Pipelines, Deployment Patterns, and Failure Modes
devops·可观测·observability·open telemetry
不厌 -_-2 天前
gitlab中怎么创建MR提交模板
gitlab·mr
MC皮蛋侠客2 天前
uv 系列(七):CI/CD、Docker 与私有索引——生产级交付
python·ci/cd·docker·uv
尽兴-2 天前
企业业务系统架构选型与渐进式演进
运维·系统架构·devops
diving deep2 天前
CI/CD
ci/cd
酿情师2 天前
Gitlab 任意文件读取漏洞(CVE-2016-9086)
gitlab