Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 52,144
    • Issues 52,144
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,551
    • Merge requests 1,551
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #387808
Closed
Open
Issue created Jan 11, 2023 by Pedro Pombeiro@pedropombeiroDeveloper

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

  1. Implement permissions and policies to create a new runner based on the group and project of a given user: Only owners and maintainers are able to add a new runner.
  2. Implement Ci::Runners::CreateRunnerService based on Ci::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 the Ci::Runner constructor. This allows the runner to be created with the glrt- token;
  • It will set the creator field to the user that invoked the service (current_user);
  1. 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.

Edited Mar 27, 2023 by Pedro Pombeiro
Assignee
Assign to
Time tracking