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

相关推荐
_.Switch1 小时前
高级Python自动化运维:容器安全与网络策略的深度解析
运维·网络·python·安全·自动化·devops
心灵彼岸-诗和远方3 小时前
DevOps业务价值流:架构设计最佳实践
运维·产品经理·devops
心灵彼岸-诗和远方14 小时前
Devops业务价值流:软件研发最佳实践
运维·产品经理·devops
上辈子杀猪这辈子学IT16 小时前
【Zookeeper集群搭建】安装zookeeper、zookeeper集群配置、zookeeper启动与关闭、zookeeper的shell命令操作
linux·hadoop·zookeeper·centos·debian
A ?Charis1 天前
Gitlab-runner running on Kubernetes - hostAliases
容器·kubernetes·gitlab
IT-民工211101 天前
CI/CD 实践总结
运维·ci/cd·自动化
秋说1 天前
开源代码管理平台Gitlab如何本地化部署并实现公网环境远程访问私有仓库
gitlab·源代码管理
大卡尔1 天前
Reviewbot 开源 | 为什么我们要打造自己的代码审查服务?
devops·code review·静态检查·工程效率
极小狐2 天前
驭码上新,AI Code Review、基于代码库的知识问答,让研发起飞
gitlab·devsecops·devops·极狐gitlab·安全合规
UsamaBinLaden2 天前
Ubuntu和Debian系列的Release默认shell解释器变更
linux·ubuntu·debian