Create a Gitlab runner on the desired entity and keep track of the token. If in doubt we recommend a group runner.
Entity | Path | Default |
---|---|---|
Instance | Admin / CI/CD / Runners > New instance runner | |
Group | Build / Runners > New group runner | ✓ |
Project | Settings / CI/CD / Runners > New project runner |
The entity type names are links to docs on how to create the runner.
Scope
The runner scope is determined by the entity to which it is attached. For most use-cases a group runner is best:
- instance runners are restricted to administrators and thus will only be available on self-hosted Gitlab instances
- project is generally too narrow unless you are sure it will only be used for a single project
A group runner will be able to execute jobs for all child groups/projects unless explicitly disabled. In the example below a runner attached to Group 1 would see jobs for Project A, B, and E.
- Gitlab Instance
- Group 1
- Project A
- Project B
- Group 3
- Project E
- Group 2
- Project C
- Project D
- Group 1
Changing later can be accomplished by creating a new runner and updating the token in your configuration.
Terraform
The Gitlab Terraform provider is quite functional and
can be used to create a runner via the gitlab_user_runner
resource.
data "gitlab_group" "default" {
full_path = "path/to/group"
}
resource "gitlab_user_runner" "default" {
runner_type = "group_type"
group_id = data.gitlab_group.default.id
description = "Cedar CI"
tag_list = ["cedarci"]
maximum_timeout = 60 * 60
}
output "token_runner" {
value = gitlab_user_runner.default.token
}