voxpupuli / puppet-gitlab_ci_runner

Module to mange gitlab CI runners. Extracted from https://github.com/voxpupuli/puppet-gitlab
Apache License 2.0
14 stars 52 forks source link

config.toml content is not expected cause gitlab-runner can't start #141

Open YutangShi opened 2 years ago

YutangShi commented 2 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

Here is my yaml config.

docker::version: "5:19.03.12~3-0~ubuntu-%{facts.os.distro.codename}"
docker::root_dir: /data/docker
docker::storage_driver: overlay2

gitlab_ci_runner::concurrent: 4
gitlab_ci_runner::manage_docker: true

gitlab_ci_runner::config_path: "/etc/gitlab-runner/config.toml"
gitlab_ci_runner::package_ensure: "14.5.0"

gitlab_ci_runner::runners:
  "%{::hostname}":
    url: "url"
    registration-token: "token"
    tag-list: "testing"
    ensure: present

gitlab_ci_runner::runner_defaults:
  url: "url"
  registration-token: "token"
  ensure: present

What are you seeing

gitlab-runner can't start, and i got config.toml parsing error.

gitlab-runner[22542]: #033[31;1mFATAL: Service run failed   #033[0;m  #033[31;1merror#033[0;m=Near line 2 (last key parsed ''): bare keys cannot contain '('
gitlab-runner.service: Main process exited, code=exited, status=1/FAILURE
gitlab-runner.service: Failed with result 'exit-code'.

The wrong config.toml rendered by puppet.

# MANAGED BY PUPPET
concurrent = 4
Deferred({'name' => 'gitlab_ci_runner::to_toml', 'arguments' => [{'runners' => [{'url' => 'url', 'executor' => 'docker', 'docker' => {'image' => 'ruby:2.1'}, 'builds_dir' => '/tmp', 'cache_dir' => '/tmp', 'name' => 'gitlab-testing-runner', 'token' => Deferred({'name' => 'gitlab_ci_runner::register_to_file', 'arguments' => ['url', 'token', {'tag_list' => 'testing'}, undef, undef]})}]}]})

What behaviour did you expect instead

I expect gitlab-runner config look like this.

[[runners]]
  name = "gitlab-runner-testing"
  url = "url"
  token = "token"
  executor = "docker"
  builds_dir = "/cache/builds"
  environment = ["DOCKER_DRIVER=overlay2"]
  [runners.custom_build_dir]

Output log

Any additional information you'd like to impart

dimov-cz commented 2 years ago

I have same issue on new node (Debian Bullseye, puppet-agent 7.26, 6.26).

dimov-cz commented 2 years ago

Solved for me: Local puppet agent had in config preferred_serialization_format: pson. This is probably incompatible with Deferred, must be json (default option)