如何在 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。

相关推荐
Suwg2095 小时前
【由浅入深认识Maven】第4部分 maven在持续集成中的应用
servlet·ci/cd·maven
周杰伦_Jay5 小时前
详细介绍:持续集成与持续部署(CI/CD)技术细节(关键实践、CI/CD管道、优势与挑战)
程序人生·ci/cd·docker·微服务·云原生·容器·人机交互
节省钱14 小时前
【Git】如何在 Git 提交后补充 Change-Id
服务器·git·gitee·gitlab·github·gitcode
小钟不想敲代码17 小时前
自动化部署(二):Jenkins持续集成(CI/CD)
ci/cd·自动化·jenkins
青草地溪水旁20 小时前
Debian或Ubuntu系统中重置MySQL的root密码
mysql·ubuntu·debian
dujunqiu1 天前
gitlab处理空文件夹的提交或空文件夹提交失败
git·gitlab·github
摸鱼仙人~1 天前
将本地项目上传到 GitLab/GitHub
elasticsearch·gitlab·github
pingxiaozhao2 天前
Windows的docker中安装gitlab
docker·容器·gitlab
Channing Lewis2 天前
如何实现gitlab和jira连通
gitlab·jira
凌鲨2 天前
OpenSeaOtter使用手册-变更通知和持续部署
ci/cd