Skip to content

Most command line options are ignored

I've been trying this with different gitlab-runner versions. From 9.5.0 to 10.8.0, all with the same results. The thing is that I'm trying to create a lot of runners in remote machines using ansible, and the command line arguments seem to be ignored (ofc I've tried all this without ansible.. the problem apparently is with the gitlab-runner-cli).

Here's the command I'm running to register a runner:

    gitlab-runner register -n \
      --url $GITLAB_URL \
      --registration-token $RUNNER_TOKEN \
      --name $HOST_NAME \
      --limit 2 \
      --executor docker \
      --docker-image node \
      --docker-tlsverify false \
      --docker-dns 192.168.0.2 \
      --docker-privileged true \
      --docker-disable-cache false \
      --docker-volumes /var/run/docker.sock:/var/run/docker.sock:ro \
      --docker-volumes /srv/cache:/cache:rw \
      --env DOCKER_DRIVER=overlay2 \
      --env COMPOSER_CACHE_DIR=/cache \
      --env YARN_CACHE_FOLDER=/cache \
      --env NPM_CONFIG_CACHE=/cache \
      --env bower_storage__packages=/cache \
      --env GEM_SPEC_CACHE=/cache \
      --env PIP_DOWNLOAD_CACHE=/cache

Which generates this .toml file:

concurrent = 1
check_interval = 0

[[runners]]
  name = "HOST_NAME"
  limit = 2
  url = "GITLAB_URL"
  token = "RUNNER_TOKEN"
  executor = "docker"
  [runners.docker]
    tls_verify = true
    image = "node"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

As you can see, a lot of options are missing, and others have incorrect values. At least these have been ignored:

  • --docker-tlsverify
  • --docker-dns
  • --docker-privileged
  • --docker-volumes
  • --env

As said, I've tried from gitlab-runner 9.5.0 to 10.8.0 (passing throughout 10.5.0 and others), all of them failed with the same problem.

Obviously all the options are taken from gitlab-runner register --help output.

Am I doing something wrong? Because I'm confused to see this fails in a lot of versions and no one created a ticket for it.

Edited by Òscar Casajuana