Skip to content

GraphQL: Create group and project runners in runnerCreate mutation

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR adapts the runnerCreate mutation introduced in !110593 (merged) to be able to create group and project runners, in addition to the instance runners that it was able to create.

The supporting service was adapted accordingly.

Closes #393889 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Pick a group from http://gdk.test:3000/dashboard/groups and note its database ID (let's say it is ID 24):

    image

  2. Enable the feature flag locally in a rails console bin/rails c:

    Feature.enable(:create_runner_workflow_for_namespace, Group.find(24))
  3. Visit http://gdk.test:3000/-/graphql-explorer

  4. Run this mutation:

    mutation runnerCreate($input: RunnerCreateInput!) {
      runnerCreate(input: $input) {
        runner {
          ephemeralAuthenticationToken
    
          runnerType
          description
          maintenanceNote
          paused
          tagList
          accessLevel
          locked
          maximumTimeout
          runUntagged
    
          #############################
          # if runnerType == GROUP_TYPE
          groups {
            nodes {
              id
            }
          }
          #############################
    
          #############################
          # if runnerType == PROJECT_TYPE
          ownerProject {
            id
          }
          #############################
        }
        errors
      }
    }

    and some example variables (use the ID from the group above in groupId):

    {
      "input": {
        "runnerType": "PROJECT_TYPE",
        "groupId": "gid://gitlab/Group/24",
        "description": "my awesome description",
        "maintenanceNote": "often.",
        "paused": true
      }
    }

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pedro Pombeiro

Merge request reports

Loading