Skip to content

Create GraphQL Query for a single GitLab Runner

Background

The GitLab runners connected to an instance are not yet available as entities in our GraphQL API, this issue's goal is to add our first runner query with some the basic fields to it.

Proposal

To make a first iteration, this task would include fetching a single runner, from a database id, with the query:

runner(id) {
  ipAddress,
  description,
  active,
  accessLevel,
  revision,
  runUntagged,
  version,
  maximumTimeout,
  lastContactedAt,
  architecture,
  platform,
  runnerType,
  id,
  locked,
  shortSha
}

As a first step in creation of the runner entity, we only define fields with GraqhQL Scalar types that the REST API already provides, the fields proposed for GraphQL migration are:

Basic fields

  • ipAddress: String!
  • description: String
  • active: Boolean!
  • revision: String!
  • runUntagged: Boolean!
  • version: String!
  • maximumTimeout: Int (in seconds)
  • lastContactedAt: Time
  • architecture: String (optional?)
  • platform: String (optional?)
  • id: ID! ID of the runner.
  • locked: Boolean (Relevant when runnerType == PROJECT)
  • shortSha: String (8 char substring of the full runner token)

Additional enums (possibly as separate MR)

  • runnerType: Enum! INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE
  • accessLevel: Enum! Can be NOT_PROTECTED, REF_PROTECTED
  • status: Enum! Can be ONLINE, PAUSED, OFFLINE, NOT_CONNECTED.

Candidates for removal:

  • name: String (in the REST API but not used in the UI, duplicate of description?)
  • is_shared: Boolean! (can be removed, as it is redundant with runnerType)

Not in scope (to avoid relationships of Nodes/Edges in this issue):

  • tag_list
  • groups
  • projects

Appendix: Current API

This is a current result of our API. More details are available at: https://docs.gitlab.com/ee/api/runners.html#get-runners-details

{
  "access_level": "not_protected",
  "active": false,
  "architecture": "amd64",
  "contacted_at": "2021-03-22T21:25:32.008Z",
  "description": "mrincon-gl-macbook-pro.local",
  "groups": [],
  "id": 4,
  "ip_address": "127.0.0.1",
  "is_shared": true,
  "locked": true,
  "maximum_timeout": null,
  "name": "gitlab-runner",
  "online": false,
  "platform": "darwin",
  "projects": [],
  "revision": "ece86343",
  "run_untagged": true,
  "status": "paused",
  "tag_list": [
    "my_tag"
  ],
  "version": "13.5.0"
}
Edited by Pedro Pombeiro