Gitlab CI/CD 没有拾取 docker 图片

Gitlab CI/CD not picking up docker image

我是 Gitlab 的新手 CI/CD,因此这个问题对其他人来说可能看起来很基础。

我创建了两个作业 - 一个由在 VM 上配置的 GitlabRunner 拾取,另一个应该 运行 在指定的 docker 图像上。

我的 .gitlab-ci.yml 看起来像这样:

stages:

- build
- deploy

job1:

   stage: build

  script:
  - *do something*

tags:
  - matlab    # specific gitlab runner is configured for this tag

job2:

  image: *docker-image*   # this is the docker image i want to use

  stage: deploy

  script:
  - *do something*

我观察到,有时 GitLab CI/CD 运行s job2 也在为 matlab 标签配置的虚拟机上。

这看起来确实不寻常。以前有人观察过吗?

谢谢!

一个job tag is different from a runner using tags.

您还需要:

Prevent Runners with tags from picking jobs without tags

You can configure a Runner to prevent it from picking jobs with tags when the Runner does not have tags assigned.
This setting can be enabled the first time you register a Runner and can be changed afterwards under each Runner's settings.

To make a Runner pick tagged/untagged jobs:

  • Visit your project's Settings ➔ CI/CD
  • Find the Runner you wish and make sure it's enabled
  • Click the pencil button
  • Check the Run untagged jobs option Click Save changes for the changes to take effect