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 53 forks source link

Gitlab runner failed to register: Forbidden #125

Closed chrisongthb closed 3 years ago

chrisongthb commented 3 years ago

Affected Puppet, Ruby, OS and module versions/distributions

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

contain ::gitlab_ci_runner
---
gitlab_ci_runner::concurrent: 4

gitlab_ci_runner::runner_defaults:
  url: 'https://...'
  registration-token: '...'
  executor: 'docker'
  docker:
    image: 'ubuntu:focal'
  builds_dir: '/tmp'
  cache_dir: '/tmp'

gitlab_ci_runner::runners:
  my_test_repo:
    registration-token: '...'

What are you seeing

# puppet agent -t
Info: Using configured environment '...'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Failed to apply catalog: Gitlab runner failed to register: Forbidden

What behaviour did you expect instead

Notice: Applied catalog in XX.xx seconds

Output log

# puppet agent -t --debug
[...]
Debug: Caching connection for https://compiler:port
Error: Failed to apply catalog: Gitlab runner failed to register: Forbidden
Debug: Resolving service 'report' using Puppet::HTTP::...
[...]

Any additional information you'd like to impart

alexjfisher commented 3 years ago

@bastelfreak Do I recall you saying you'd experienced the same in your environment?

bastelfreak commented 3 years ago

I had a similar issue, I might be able to gather some logs in the next days when I'm in that specific environment again. @chrisongthb when you do a --debug run you sould see the gitlab-runner register call, can you paste that?

chrisongthb commented 3 years ago

@bastelfreak unfortunately I cannot see any additional debug logs, when I run the agent with --debug. The lines in "Output log" above are all I get from --debug.

chrisongthb commented 3 years ago

After adding some debug statements in lib/puppet_x/gitlab/runner.rb I realized, that the registration-token in the hieradata was simply wrong. I must have clicked "reset registration token" too often :woozy_face: Sorry for the noise :grimacing:

alexjfisher commented 3 years ago

@chrisongthb No worries. That's good news!

@bastelfreak What's your excuse? ;)