Registering runner fails with missing registration token
I used this role around a year ago to build runners with Debian 10. Back then our Gitlab version was 14.0.5 and everything just worked.
Now I migrated the Gitlab server from CentOS 7 to Debian 11, upgraded it from 14.0.5 to 14.9.2 and started creating new runners also on Debian 11.
Playbook failed with the following error:
PANIC: The registration-token needs to be entered
Next I tried to run the registration manually from the runner:
/usr/bin/gitlab-runner register --non-interactive --url https://git.example.com/ --description "GitLab runner (fast jobs) @ gitlabrunner.example.com" --tag-list "" --executor docker --limit 4 --output-limit 4096 --locked=False --env DOCKER_HOST=tcp://docker:2376 --env DOCKER_TLS_CERTDIR=/certs/${CI_JOB_ID} --env DOCKER_CERT_PATH=/certs/${CI_JOB_ID}/client --env DOCKER_TLS_VERIFY=1 --env DOCKER_AUTH_CONFIG={\"auths\": {\"git.example.com:4567\": {\"auth\": \"xxxxxxx\"}}} --docker-image docker:20-dind --docker-privileged --docker-tlsverify True --docker-volumes /tmp/gitlab/docker/certs:/certs --docker-volumes /cache --docker-volumes /etc/docker/daemon.json:/etc/docker/daemon.json:ro --ssh-user --ssh-host --ssh-port --ssh-identity-file --registration-token secretToken --ssh-password
This one gave this error:
WARN[0000] boolean parameters must be passed in the command line with --docker-tlsverify=true
WARN[0000] parameters after this may be ignored
Runtime platform arch=amd64 os=linux pid=18241 revision=f188edd7 version=14.9.1
Running in system-mode.
PANIC: The registration-token needs to be entered
Notice the error between
--docker-tlsverify True
in the command and
--docker-tlsverify=true
in the error message.
I checked that in Ansible variables, I've set:
docker_tlsverify: true
What made the registration work for me was to change this line from this:
--docker-tlsverify '{{ gitlab_runner.docker_tlsverify|default("true") }}'
to this:
--docker-tlsverify='{{ gitlab_runner.docker_tlsverify|default("true") }}'
Has anyone else faced this? I could create a PR, if I knew that it is not just me. On the other hand, maybe the problem is on the Gitlab server side, which is not accepting space but requires an equal sign.