I am trying to set up a simple Gitlab runner on one of my projects on my Gitlab server (not Gitlab.com), but when I run sudo gitlab-ci-multi-runner register I get back:
ERROR: Registering runner... failed runner=<token> status=401 Unauthorized
PANIC: Failed to register this runner. Perhaps you are having network problems
I am not having network problems - I can ping and SSH to the Gitlab server from the runner’s machine.
The Gitlab server has a valid certificate, not a self-signed one.
I am trying to set up a private runner, the token comes from https://my-gitlab-server/my-project/settings/ci_cd.
The CI URL from the same page is: https://my-gitlab-server/ci
In the server-side logs, I see the 401 returned, but there’s no information about why it’s a 401:
==> /var/log/gitlab/gitlab-rails/production.log <==
Started POST "/api/v4/runners" for <runnerip> at 2017-03-23 13:18:04 -0600
==> /var/log/gitlab/gitlab-workhorse/current <==
2017-03-23_19:18:04.37172 <gitlab server> @ - - [2017-03-23 13:18:04.366723579 -0600 MDT] "POST /api/v4/runners HTTP/1.1" 401 30 "" "gitlab-ci-multi-runner 9.0.0 (9-0-stable; go1.7.5; linux/amd64)" 0.004886
==> /var/log/gitlab/nginx/gitlab_access.log <==
<runnerip> - - [23/Mar/2017:13:18:04 -0600] "POST /api/v4/runners HTTP/1.1" 401 30 "-" "gitlab-ci-multi-runner 9.0.0 (9-0-stable; go1.7.5; linux/amd64)"
==> /var/log/gitlab/gitlab-rails/production.log <==
Started POST "/ci/api/v1/builds/register.json" for 134.253.210.47 at 2017-03-23 13:18:04 -0600
The Gitlab server is Gitlab CE 8.17.2 (omnibus) running on Ubuntu 16.04.
The Gitlab runner is version 9.0.0, running on Ubuntu 14.04.
I had exactly the same with Gitlab 8.16.x and three already registered runners a while back. Issue solved itself after some hours. Try restarting Gitlab and your runner server.
I got the same issue. I’m using both gitlab and gitlab-runner on docker.
Gitlab works perfect on docker but when I run gitlab-runner register, I get the same error, 401 Unauthorized.
Good call, thank you. Fixed on RHEL/CentOS7 by running: sudo yum install gitlab-ci-multi-runner-1.11.1-1.x86_64
@eadmin indeed, something seems amiss in the overnight jump from version 1.x to 9.x — perhaps this corresponds to the latest GitLab version 9.0, while the previous GitLab 8.x versions must use runner versions 1.x.