极狐GitLab 是 GitLab 在中国的发行版,专门面向中国程序员和企业提供企业级一体化 DevOps 平台,用来帮助用户实现需求管理、源代码托管、CI/CD、安全合规,而且所有的操作都是在一个平台上进行,省事省心省钱。可以一键安装极狐GitLab,详情可以参考极狐GitLab 下载安装官网。
GitLab 中文版学习资料
- 驭码CodeRider 官网:https://coderider.gitlab.cn/
- GitLab 中文版官网:https://gitlab.cn
- GitLab 中文文档:https://docs.gitlab.cn
- GitLab 中文下载安装:https://gitlab.cn/install
关联阅读
- 如何在 Debian 上安装运行极狐GitLab Runner?【一】
上一篇文章中,我们演示了如何在 Debian 上通过安装包安装极狐GitLab Runner,本篇文章,我们演示用 docker 的方式在 Debian 上安装运行极狐GitLab Runner。
用容器的方式安装
首先要确保有 docker环境。用 info或 version查看即可:
docker version
Client: Docker Engine - CommunityVersion: 26.0.0API version: 1.45Go version: go1.21.8Git commit: 2ae903eBuilt: Wed Mar 20 15:18:01 2024OS/Arch: linux/amd64Context: defaultServer: Docker Engine - CommunityEngine:Version: 26.0.0API version: 1.45 (minimum version 1.24)Go version: go1.21.8Git commit: 8b79278Built: Wed Mar 20 15:18:01 2024OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.6.28GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bbrunc:Version: 1.1.12GitCommit: v1.1.12-0-g51d5e94docker-init:Version: 0.19.0GitCommit: 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。