riemers / ansible-gitlab-runner

Ansible role to install gitlab-runner
MIT License
351 stars 267 forks source link

register-runner can no longer specify various tags #353

Open patrickstump opened 4 hours ago

patrickstump commented 4 hours ago

With the transition to "authentication tokens", the runner registration is no longer allowing certain tags on the registration command line.

I found this while trying to register a mac runner, but it should be the same for other OSes as well.

Error:

TASK [riemers.gitlab-runner : Register runner to GitLab] *****************************************************************************************************************************
fatal: [runner-mac-1]: FAILED! => {"changed": true, "cmd": ["/opt/homebrew/bin/gitlab-runner", "register", "--non-interactive", "--url", "https://git.example.com/", "--description", "runner-mac-1-shell", "--tag-list", "", "--executor", "shell", "--limit", "0", "--output-limit", "4096", "--locked=False", "--tls-ca-file", "/etc/ssl/certs/ca.pem", "--docker-image", "", "--ssh-user", "", "--ssh-host", "", "--ssh-port", "", "--ssh-identity-file", "", "--cache-type", "s3", "--cache-shared", "--cache-path", "cache", "--cache-s3-server-address", "minio.example.com:9001", "--cache-s3-access-key", "gitlab-runner-cache", "--cache-s3-bucket-name", "shell", "--cache-s3-bucket-location", "us-east-1", "--registration-token", "xxxxxx\n", "--cache-s3-secret-key", "xxxxxxxx\n", "--ssh-password", ""], "delta": "0:00:00.040835", "end": "2024-11-18 11:57:33.247465", "msg": "non-zero return code", "rc": 1, "start": "2024-11-18 11:57:33.206630", "stderr": "Runtime platform                                  \u001b[0;m  arch\u001b[0;m=arm64 os\u001b[0;m=darwin pid\u001b[0;m=61212 revision\u001b[0;m=12030cf4 version\u001b[0;m=17.5.3\nRunning in system-mode.                           \u001b[0;m \n                                                  \u001b[0;m \n\u001b[31;1m

FATAL: Runner configuration other than name and executor configuration is reserved (specifically --locked, --access-level, --run-untagged, --maximum-timeout, --paused, --tag-list, and --maintenance-note) and cannot be specified when registering with a runner authentication token. This configuration is specified on the GitLab server. Please try again without specifying any of those arguments. For more information, see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow.html#changes-to-the-gitlab-runner-register-command-syntax\u001b[0;m ",
 "stderr_lines": ["Runtime platform                                  \u001b[0;m  arch\u001b[0;m=arm64 os\u001b[0;m=darwin pid\u001b[0;m=61212 revision\u001b[0;m=12030cf4 version\u001b[0;m=17.5.3", "Running in system-mode.                           \u001b[0;m ",
 "                                                  \u001b[0;m ", "\u001b[31;1mFATAL: Runner configuration other than name and executor configuration is reserved (specifically --locked, --access-level, --run-untagged, --maximum-timeout, --paused, --tag-list, and --maintenance-note) and cannot be specified when registering with a runner authentication token. This configuration is specified on the GitLab server. Please try again without specifying any of those arguments. For more information, see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow.html#changes-to-the-gitlab-runner-register-command-syntax\u001b[0;m "], "stdout": "", "stdout_lines": []}

Reformatted slightly for easier reading.

I was able to move past by:

Setting: run_untagged: false

In the role task file register-runner.yml, removing the --locked and --tag-list runner registration options allowed it to move past the error.

guenhter commented 4 hours ago

With the transition to "authentication tokens", the runner registration is no longer allowing certain tags on the registration command line.

https://github.com/riemers/ansible-gitlab-runner/issues/350#issuecomment-2429142595

guenhter commented 4 hours ago

Nevertheless, we should fail the role early if parameters are set which are not supported (like tag list in combination with the auth token).