Docker 上的 Gitlab 持续集成

Gitlab Continuous Integration on Docker

我在 Docker 容器上有一个 Gitlab 服务器 运行:gitlab docker

在 Gitlab 上有一个带有简单 Makefile 的项目,它运行 pdflatex 来构建 pfd 文件。

在Docker容器上我安装了texlive和make,我还安装了docker runner,命令:

curl -sSL https://get.docker.com/ | sh

.gitlab-ci.yml 如下所示:

.build:
  script: &build_script
  - make

build: 
  stage: test
  tags:
    - Documentation Build
  script: *build

作业卡住运行并显示一条消息:

This build is stuck, because the project doesn't have any runners online assigned to it 

有什么想法吗?

我觉得你在这里有点困惑。从这条评论来看:

On the Docker container I installed texlive and make, I also installed docker runner, command:

curl -sSL https://get.docker.com/ | sh

您似乎在 docker 中安装了 docker,但实际上并没有安装任何运行器?如果是这样的话,这将行不通。得到这个 运行 的步骤是:

  • 部署一个新的 gitlab runner。最快的方法是使用 gitlab runner docker image. You can't run a runner inside the docker container you've deployed gitlab in. You'll need to make sure you select an executor (I suggest using the shell executor to get you started) and then you need to register the runner. There is more information about how to do this here. What isn't detailed here is that if you're using docker for gitlab and docker for gitlab-runner, you'll need to link the containers or set up a docker network 部署 另一个 docker 容器,这样它们就可以相互通信
  • 一旦您使用 gitlab 部署并注册了运行器,您将看到它出现在 http(s)://your-gitlab-server/admin/runners - 从这里您需要将它分配给一个项目。您也可以将其设置为 "Shared" runner,它将执行所有项目的作业。
  • 最后,添加您已有的 .gitlab-ci.yml,构建将按预期运行。

您 link 的最高评论是:

"Gitlab is good, but this container is absolutely bonkers."

再看看 gitlab's own advice 你应该 不应该在 windows 上使用这个容器,永远

如果你想从 Gitlab 服务器使用 Gitlab-CI,你实际上应该在适当的支持 Linux VM 上安装适当的 Gitlab 服务器实例,使用 Omnibus,并且不应该尝试将此容器用于明显不适合的目的:运行 Gitlab 的实际生产方式。

Gitlab-omnibus 包含:

  1. 由 postgres 提供支持的持久(不是无状态!)数据层。

  2. 现有聊天服务器的全部意义在于成为团队聊天的持久日志。

  3. 不是一个,而是一系列服务器进程,它们协同工作为您提供 gitlab 服务器功能和 Web admin/management 前端,在我看来并不理想的设计是 运行 在生产里面 docker.

  4. 一个集成的CI构建管理器,本身就是一个Docker容器管理器。您的 docker 个实例将包含其他 docker 个实例的缓存。

这个容器是由 Gitlab 自己构建的,这并不表示您实际上应该将它用于除 test/toy 之外的任何其他用途或 Gitlab 自己实际使用它的用途,这可能是为了让人们旋转起​​来Gitlab 每晚构建,可能通过 kubernetes。

也许你和我一样设置了错误的标签。请确保标签名称与您可用的跑步者。

tags - Documentation Build # tags is used to select specific Runners from the list of all Runners that are allowed to run this project.

参见:https://docs.gitlab.com/ee/ci/yaml/#tags