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

相关推荐
极小狐4 小时前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab
宁酱醇4 小时前
GitLab_密钥生成(SSH-key)
运维·ssh·gitlab
极小狐4 小时前
极狐GitLab 如何 cherry-pick 变更?
人工智能·git·机器学习·gitlab
云攀登者-望正茂5 小时前
60个GitLab CI/CD 面试问题和答案
ci/cd·gitlab·devops
懿瑾8 小时前
GitLab Auth2授权-Express + passport-gitlab2
gitlab·angular.js
zhang238390615420 小时前
IDEA add gitlab account 提示
java·gitlab·intellij-idea·idea
宁酱醇1 天前
各种各样的bug合集
开发语言·笔记·python·gitlab·bug
极小狐1 天前
极狐GitLab Git LFS 速率限制如何设置?
运维·git·ssh·gitlab·github
极小狐1 天前
如何解决极狐GitLab 合并冲突?
人工智能·git·机器学习·gitlab
wish3662 天前
【APM】How to enable Trace to Logs on Grafana?
经验分享·grafana·devops