Gitlab Runner 没有拉取在 gitlab 中定义为服务的图像-ci.yml
Gitlab Runner not pulling image defined as service in gitlab-ci.yml
出于某种原因,Gitlab 中的 Gitlab Runner 没有拉取或使用我在 gitlab 中定义为服务的图像-ci.yml。我在本地安装了gitlab-runner,一切正常,但是当我推送到Gitlab时,它不起作用。我在这里丢了。
gitlab-ci.yml:
build:
stage: build
services:
- mysql
image: chilio/laravel-dusk-ci:stable
Gitlab 的输出,仅使用 image
,而不是 services
:
定义的图像
Running with gitlab-ci-multi-runner 9.5.0 (413da38)
on gitlab-runner-gitlab-runner-3695154600-vj3bh (8620b628)
Using Kubernetes namespace: default
Using Kubernetes executor with image chilio/laravel-dusk-ci:stable ...
Waiting for pod default/runner-8620b628-project-1-concurrent-0jqbbv to be running, status is Pending
Running on runner-8620b628-project-1-concurrent-0jqbbv via gitlab-runner-gitlab-runner-3695154600-vj3bh...
Cloning repository...
从我的本地机器输出,拉两个:
Running with gitlab-ci-multi-runner 9.5.0 (413da38)
on ()
Using Docker executor with image chilio/laravel-dusk-ci:stable ...
Starting service mysql:latest ...
Pulling docker image mysql:latest ...
Using docker image mysql:latest ID=sha256:f0f3956a9dd825e3195f0d1a4fe17cc94b0f6934fc470b09abf8fad87d17ff24 for mysql service...
Waiting for services to be up and running...
Using docker image sha256:64cbb31659359752dd4fb4580047faf5b0ec487258d09ca8a97897a0ba615d1b for predefined container...
Pulling docker image chilio/laravel-dusk-ci:stable ...
Using docker image chilio/laravel-dusk-ci:stable ID=sha256:a07a953be1b12bc294b5bbdb229fe7312c2916b7ad3397ff970b8145165e36e7 for build container...
Running on runner--project-0-concurrent-0 via mchale...
我在这里错过了什么?
您必须在 .gitlab-ci.yml
的根级别上定义 services
。如 docs.
中所示
您的文件将如下所示:
services:
- mysql:latest
variables:
# Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
MYSQL_DATABASE: el_duderino
MYSQL_ROOT_PASSWORD: mysql_strong_password
build:
stage: build
image: chilio/laravel-dusk-ci:stable
想通了。是由于 Kubernetes 执行器的性质,它的工作方式有点不同。使用 Kubernetes 构建时,服务是在运行器容器旁边的 pod 中构建的,因此运行器不会宣布它正在加载该图像。更多信息在这里:
出于某种原因,Gitlab 中的 Gitlab Runner 没有拉取或使用我在 gitlab 中定义为服务的图像-ci.yml。我在本地安装了gitlab-runner,一切正常,但是当我推送到Gitlab时,它不起作用。我在这里丢了。
gitlab-ci.yml:
build:
stage: build
services:
- mysql
image: chilio/laravel-dusk-ci:stable
Gitlab 的输出,仅使用 image
,而不是 services
:
Running with gitlab-ci-multi-runner 9.5.0 (413da38)
on gitlab-runner-gitlab-runner-3695154600-vj3bh (8620b628)
Using Kubernetes namespace: default
Using Kubernetes executor with image chilio/laravel-dusk-ci:stable ...
Waiting for pod default/runner-8620b628-project-1-concurrent-0jqbbv to be running, status is Pending
Running on runner-8620b628-project-1-concurrent-0jqbbv via gitlab-runner-gitlab-runner-3695154600-vj3bh...
Cloning repository...
从我的本地机器输出,拉两个:
Running with gitlab-ci-multi-runner 9.5.0 (413da38)
on ()
Using Docker executor with image chilio/laravel-dusk-ci:stable ...
Starting service mysql:latest ...
Pulling docker image mysql:latest ...
Using docker image mysql:latest ID=sha256:f0f3956a9dd825e3195f0d1a4fe17cc94b0f6934fc470b09abf8fad87d17ff24 for mysql service...
Waiting for services to be up and running...
Using docker image sha256:64cbb31659359752dd4fb4580047faf5b0ec487258d09ca8a97897a0ba615d1b for predefined container...
Pulling docker image chilio/laravel-dusk-ci:stable ...
Using docker image chilio/laravel-dusk-ci:stable ID=sha256:a07a953be1b12bc294b5bbdb229fe7312c2916b7ad3397ff970b8145165e36e7 for build container...
Running on runner--project-0-concurrent-0 via mchale...
我在这里错过了什么?
您必须在 .gitlab-ci.yml
的根级别上定义 services
。如 docs.
您的文件将如下所示:
services:
- mysql:latest
variables:
# Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
MYSQL_DATABASE: el_duderino
MYSQL_ROOT_PASSWORD: mysql_strong_password
build:
stage: build
image: chilio/laravel-dusk-ci:stable
想通了。是由于 Kubernetes 执行器的性质,它的工作方式有点不同。使用 Kubernetes 构建时,服务是在运行器容器旁边的 pod 中构建的,因此运行器不会宣布它正在加载该图像。更多信息在这里: