debops / debops/debops

[gitlab_runner] Generate invalid config.toml when defined docker_services

Open
#1,555 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jinja
Stars
1.4k
Forks
379
Avg merge
4d 18h
Merged PRs (30d)
8

Description

Definition of docker services in config.toml does not match the runner configuration.
Should be nested section [[runners.docker.services]] instead of list of strings.

Inventory variables:

gitlab_runner__default_instances:
  - name: '{{ ansible_hostname + "-docker-root" }}'
    executor: "docker"
    concurrent: "{{ ansible_processor_vcpus }}"
    run_untagged: False
    tags: [ "docker-privileged" ]
    state: "present"
    docker_privileged: True
    docker_pull_policy: "if-not-present"
    docker_image: "docker:latest"
    docker_services:
      - name: "docker:dind"

Generated config.toml

# This file is managed remotely, all changes will be lost

...

[[runners]]
  name = "runner1-docker-root"
  url = "..."
  token = "..."
  environment = [ "DOCKER_TLS_CERTDIR=/certs" ]
  executor = "docker"
  [runners.docker]
    image = "docker:latest"
    privileged = true
    disable_cache = false
    cap_drop = [ "NET_ADMIN", "SYS_ADMIN", "DAC_OVERRIDE" ]
    services = [ "{'name': 'docker:dind'}" ]
    volumes = [ "/certs/client" ]
    pull_policy = "if-not-present"

Start/restart gitlab-runner is failed with this config. From logs:

Nov 10 13:08:54 runner1 gitlab-runner[3329697]: Starting multi-runner from /etc/gitlab-runner/config.toml...#033[0;m  builds#033[0;m=0
Nov 10 13:08:54 runner1 gitlab-runner[3329697]: Running in system-mode.                           #033[0;m
Nov 10 13:08:54 runner1 gitlab-runner[3329697]: Running in system-mode.                           #033[0;m
Nov 10 13:08:54 runner1 gitlab-runner[3329697]:                                                   #033[0;m
Nov 10 13:08:54 runner1 gitlab-runner[3329697]:                                                   #033[0;m
Nov 10 13:08:54 runner1 gitlab-runner[3329697]: #033[31;1mFATAL: Service run failed                         #033[0;m  #033[31;1merror#033[0;m=toml: type mismatch for common.Service: expected table but found string
Nov 10 13:08:54 runner1 gitlab-runner[3329697]: #033[31;1mFATAL: Service run failed                         #033[0;m  #033[31;1merror#033[0;m=toml: type mismatch for common.Service: expected table but found string
Nov 10 13:08:54 runner1 systemd[1]: gitlab-runner.service: Main process exited, code=exited, status=1/FAILURE

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing gitlab_runner__default_instances and docker_services through the role’s configuration template or generator into config.toml. Compare the generated services representation with GitLab Runner’s runners.docker.services schema. Done means docker services are emitted as nested tables and gitlab-runner starts successfully with the generated configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, yaml
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.