dockergitlab-cigitlab-ci-runnerdocker-imagegitlab-8

Gitlab CI/CD not picking up docker image


I am new to Gitlab CI/CD and hence this question might seem very basic to others.

I have created two jobs - one is picked up by GitlabRunner configured on a VM and other should run on specified docker image.

my .gitlab-ci.yml looks like this:

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*

I am observing that sometimes, GitLab CI/CD runs job2 also on VM configured for matlab tags.

This does seem unusual. Has anyone observed this before?

Thanks!


Solution

  • A job tag is different from a runner using tags.

    And you still need to:

    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