GraphQL: Implement mutation to create runner
In order to support the new UI in the Next Runner Token Architecture, we need to allow creating a runner through a GraphQL mutation. The new mutation should be behind a new temporary feature flag :create_runner_workflow
.
mutation runnerCreate($input: RunnerCreateInput!) {
runnerCreate(input: $input) {
runner {
ephemeralAuthenticationToken
type
description
maintenanceNote
paused
tagList
accessLevel
locked
maximumTimeout
runUntagged
#############################
# if type == GROUP_TYPE
groups {
nodes {
id
}
}
#############################
#############################
# if type == PROJECT_TYPE
ownerProject {
id
}
associatedProjects { # Optional
nodes {
id
}
}
#############################
}
errors
}
}
NOTE: Eventually, runners created by this API should return a new-style runner authentication token, but by using a FF we make this available only for our testing, and therefore don't need to be blocked by it.
Implementation plan
- Implement permissions and policies to create a new runner based on the group and project of a given user: Only
owners
andmaintainers
are able to add a new runner. - Implement
Ci::Runners::CreateRunnerService
based onCi::Runners::RegisterRunnerService
. This service will take the scope where the runner is to be created in (a group, a project, or nil if an instance runner).
- It will rely on !110275 (merged) to be able to pass a
legacy_registered: false
argument to theCi::Runner
constructor. This allows the runner to be created with theglrt-
token; - It will set the
creator
field to the user that invoked the service (current_user
);
- Implement mutation that calls
Ci::Runners::CreateRunnerService
.
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.