
GNOME GitLab 有 AWS 运行器,但它们仅在向 GNOME 上游仓库推送代码时使用,不会在你向你的个人分支推送时使用。对于个人分支,只有一个(据我所知)共享运行器,你可能在等待数小时后它才会选择你的作业。
但你知道吗,你可以注册自己的电脑,或者一个放在抽屉里积满灰尘的备用笔记本电脑,以立即开始持续集成(CI)?设置起来真的非常简单!
apt 安装 docker.io
请遵循以下说明:
https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/install/linux-repository.md#安装运行器
(注意:Ubuntu 18.04 的软件包似乎不起作用。)
sudo gitlab-runner 安装
sudo gitlab-runner start
转到您的GitLab项目页面,设置 -> CI/CD -> 展开"运行器"
sudo gitlab-runner register --non-interactive --url https://gitlab.gnome.org --executor docker --docker-image fedora:27 --registration-token ****
您可以使用相同的GitLab实例中所有个人分叉的注册令牌重复步骤5。为了简化这个过程,这里有一个我在我的 中编写的片段,用于将我的"builder.local"机器注册到新项目上。请将其用作。
定义函数gitlab-register {
host=$1
token=$2
case "$host" in
gnome)
host=https://gitlab.gnome.org
;;
fdo)
host=https://gitlab.freedesktop.org
;;
collabora)
host=https://gitlab.collabora.com
;;
*)
host=https://gitlab.gnome.org
token=$1
esac
cmd="sudo gitlab-runner register --non-interactive --url $host --executor docker --docker-image fedora:27 --registration-token $token"
#$cmd
ssh builder.local -t "$cmd"
}
不仅您现在将获得更快的持续集成(CI),而且您还将减少其他人对共享运行器上的队列的压力!
访问Xavier的博客。