Skip to content

Implement GraphQL Mutation to modify a runner details

Description

Depends on #327008 (closed)

Our runner information can be edited by administrators and users with enough privileges. We should provide a mutation for users to modify the runner in our GraphQL API.

Proposal

The UI form allows admins to modify the following runner information, as per fields described in #327008 (closed):

UpdateRunnerInput:

  • ID (runner id)
  • active: Boolean
  • runUntagged: Boolean
  • accessLevel: Enum Can be NOT_PROTECTED, REF_PROTECTED
  • locked: Boolean (Relevant when runnerType == PROJECT)
  • description: String
  • maximumTimeout: Int (in seconds)

Mutation example:

#import "../fragments/runner.fragment.graphql"

mutation updateRunner($input: UpdateRunnerInput!) {
  updateRunner(input: $input) {
    runner {
      # Fields TBD, see https://gitlab.com/gitlab-org/gitlab/-/issues/327008
      ...Runner
    }
    errors
  }
}

https://docs.gitlab.com/ee/api/runners.html#update-runners-details

Questions before implementation

👉 Why have an active flag different from status?

Our runner contains the status: Enum! that can be ONLINE, PAUSED, OFFLINE, NOT_CONNECTED and active in turn can make a runner PAUSED. However, users cannot directly change this.

All runners set to active == false are PAUSED, and runners set to active == true may be ONLINE, OFFLINE (not connected over 30 mins) or NOT_CONNECTED (never connected).

See how we calculate status: https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/ci/runner.rb#L227

Not in scope

  • Update/mutate the relationship of this runner with groups or projects.
  • List of runner tags (tag_list)
Appendix: Current Update Form UI
image
Edited by Miguel Rincon