Need assistance with or example of configuring GitLab Runner using CI/CD
Summary
When configuring a GitLab Kubernetes Runner using GitLab CI/CD, CI variable values are not applied like the documentation states they will be used. Assigning to @nagyv-gitlab @erushton and @DarrenEastman because docs page says notify 2 people from Runner group and @nagyv-gitlab was discussing with @bmiller1 in https://gitlab.slack.com/archives/CB07X8AQ3/p1621459201022200
Steps to reproduce
- Create a cluster management project from the cluster management project template on gitlab.com
- Attach a Kubernetes cluster to the GitLab project
- Set the project as the management project for the cluster
- Set the config.yaml file to install the runner
- Set the
runnerRegistrationToken
in values.yaml to use variable GITLAB_RUNNER_REGISTRATION_TOKEN - Set the CI variable GITLAB_RUNNER_REGISTRATION_TOKEN to the registration token for the project. Docs at https://docs.gitlab.com/13.11/ee/user/clusters/applications.html#install-gitlab-runner-using-gitlab-cicd say this is possible
- Commit config.yaml and values.yaml and run the pipeline
- In my example project, registration fails every time
- Registration does not fail if the
runnerRegistrationToken
is hard coded in values.yaml
Example Project
https://gitlab.com/midwest-apps/midwest-apps-cluster-management
Not public but please ask for access, I'm happy to add you.
What is the current bug behavior?
Runner registration fails
What is the expected correct behavior?
Value set in protected variable is used as registration token.
Relevant logs and/or screenshots
values.yaml syntax | Pod Log Result |
---|---|
#runnerRegistrationToken: "" (i.e. commented out) |
ERROR: Registering runner... forbidden (check registration token) runner=/builds/ |
runnerRegistrationToken: "" |
Failed to load logs: container "configure" in pod "runner-gitlab-runner-6d49687cb5-q5g8r" is waiting to start: PodInitializing Reason: BadRequest (400) |
runnerRegistrationToken: "${{GITLAB_RUNNER_REGISTRATION_TOKEN}}" |
ERROR: Registering runner... forbidden (check registration token) runner="${{GITL |
runnerRegistrationToken: ${{GITLAB_RUNNER_REGISTRATION_TOKEN}} |
ERROR: Registering runner... forbidden (check registration token) runner=${{GITLA |
`runnerRegistrationToken: ${GITLAB_RUNNER_REGISTRATION_TOKEN} | ERROR: Registering runner... forbidden (check registration token) runner=${GITLAB |
runnerRegistrationToken: $GITLAB_RUNNER_REGISTRATION_TOKEN |
ERROR: Registering runner... forbidden (check registration token) runner=$GITLAB_ |
runnerRegistrationToken: Xwm1cKXWZxWzAxXZPXmi (token changed for security) |
Registering runner... succeeded runner=Xwm1cKXW |
Output of checks
This is happening on gitlab.com but I heard about it from a self-hosted customer
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)