Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x | import { gql } from 'graphql-tag';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
/**
* GraphQL documents for CI Runners.
*
* Verified against a live GitLab 19.x instance via schema introspection:
* - Queries: `runners` (admin, instance-wide), `currentUser.runners`,
* `group/project(fullPath).runners`, `runner(id)` with a `jobs(statuses)` connection.
* - Mutations: `runnerCreate` (returns ephemeralAuthenticationToken), `runnerUpdate`
* (description/tagList/paused/... — also powers pause/resume), `runnerDelete`.
*
* GitLab has no per-runner authentication-token reset mutation in GraphQL
* (only the legacy group/project registration-token reset), so that one action
* uses the REST endpoint in the handler.
*/
const RUNNER_FIELDS = `
id
description
runnerType
status
paused
locked
runUntagged
tagList
accessLevel
maximumTimeout
jobExecutionStatus
jobCount
contactedAt
createdAt
`;
export interface RunnerNode {
id: string;
description: string | null;
runnerType: string;
status: string | null;
paused: boolean;
locked: boolean;
runUntagged: boolean;
tagList: string[] | null;
accessLevel: string | null;
maximumTimeout: number | null;
jobExecutionStatus: string | null;
jobCount: number | null;
contactedAt: string | null;
createdAt: string | null;
}
interface PageInfo {
hasNextPage: boolean;
endCursor: string | null;
}
interface RunnerConnection {
nodes: RunnerNode[];
pageInfo: PageInfo;
}
// Shared list filters (subset of the runners connection args we expose).
export interface RunnerListVars {
type?: string | null;
status?: string | null;
paused?: boolean | null;
tagList?: string[] | null;
search?: string | null;
first?: number | null;
after?: string | null;
}
const LIST_ARG_DECLS = `
$type: CiRunnerType
$status: CiRunnerStatus
$paused: Boolean
$tagList: [String!]
$search: String
$first: Int
$after: String
`;
const LIST_ARG_USE = `
type: $type
status: $status
paused: $paused
tagList: $tagList
search: $search
first: $first
after: $after
`;
// --- Query: instance-wide runners (admin) ---
export interface ListRunnersResult {
runners: RunnerConnection | null;
}
export const LIST_RUNNERS: TypedDocumentNode<ListRunnersResult, RunnerListVars> = gql`
query ListRunners(${LIST_ARG_DECLS}) {
runners(${LIST_ARG_USE}) {
nodes { ${RUNNER_FIELDS} }
pageInfo { hasNextPage endCursor }
}
}
`;
// --- Query: current user's runners ---
export interface ListOwnedRunnersResult {
currentUser: { runners: RunnerConnection | null } | null;
}
export const LIST_OWNED_RUNNERS: TypedDocumentNode<ListOwnedRunnersResult, RunnerListVars> = gql`
query ListOwnedRunners(${LIST_ARG_DECLS}) {
currentUser {
runners(${LIST_ARG_USE}) {
nodes { ${RUNNER_FIELDS} }
pageInfo { hasNextPage endCursor }
}
}
}
`;
// --- Query: group runners ---
export interface ListGroupRunnersResult {
group: { runners: RunnerConnection | null } | null;
}
export interface ListNamespaceRunnersVars extends RunnerListVars {
fullPath: string;
}
export const LIST_GROUP_RUNNERS: TypedDocumentNode<
ListGroupRunnersResult,
ListNamespaceRunnersVars
> = gql`
query ListGroupRunners($fullPath: ID!, ${LIST_ARG_DECLS}) {
group(fullPath: $fullPath) {
runners(${LIST_ARG_USE}) {
nodes { ${RUNNER_FIELDS} }
pageInfo { hasNextPage endCursor }
}
}
}
`;
// --- Query: project runners ---
export interface ListProjectRunnersResult {
project: { runners: RunnerConnection | null } | null;
}
export const LIST_PROJECT_RUNNERS: TypedDocumentNode<
ListProjectRunnersResult,
ListNamespaceRunnersVars
> = gql`
query ListProjectRunners($fullPath: ID!, ${LIST_ARG_DECLS}) {
project(fullPath: $fullPath) {
runners(${LIST_ARG_USE}) {
nodes { ${RUNNER_FIELDS} }
pageInfo { hasNextPage endCursor }
}
}
}
`;
// --- Query: a single runner ---
export interface GetRunnerResult {
runner: RunnerNode | null;
}
export interface GetRunnerVars {
id: string;
}
export const GET_RUNNER: TypedDocumentNode<GetRunnerResult, GetRunnerVars> = gql`
query GetRunner($id: CiRunnerID!) {
runner(id: $id) { ${RUNNER_FIELDS} }
}
`;
// --- Query: jobs run by a runner ---
export interface RunnerJobNode {
id: string;
name: string | null;
status: string | null;
createdAt: string | null;
finishedAt: string | null;
duration: number | null;
webPath: string | null;
}
export interface ListRunnerJobsResult {
runner: {
id: string;
jobs: { nodes: RunnerJobNode[]; pageInfo: PageInfo } | null;
} | null;
}
export interface ListRunnerJobsVars {
id: string;
statuses?: string[] | null;
first?: number | null;
after?: string | null;
}
export const LIST_RUNNER_JOBS: TypedDocumentNode<ListRunnerJobsResult, ListRunnerJobsVars> = gql`
query ListRunnerJobs($id: CiRunnerID!, $statuses: [CiJobStatus!], $first: Int, $after: String) {
runner(id: $id) {
id
jobs(statuses: $statuses, first: $first, after: $after) {
nodes {
id
name
status
createdAt
finishedAt
duration
webPath
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
`;
// --- Lookups: resolve a group/project full path to its global ID ---
// runnerCreate needs the namespace global ID, but callers pass the human path.
export interface ResolveGroupResult {
group: { id: string } | null;
}
export interface ResolveProjectResult {
project: { id: string } | null;
}
export interface ResolvePathVars {
fullPath: string;
}
export const RESOLVE_GROUP_ID: TypedDocumentNode<ResolveGroupResult, ResolvePathVars> = gql`
query ResolveGroupId($fullPath: ID!) {
group(fullPath: $fullPath) {
id
}
}
`;
export const RESOLVE_PROJECT_ID: TypedDocumentNode<ResolveProjectResult, ResolvePathVars> = gql`
query ResolveProjectId($fullPath: ID!) {
project(fullPath: $fullPath) {
id
}
}
`;
// --- Mutation: create a runner (returns ephemeral auth token) ---
export interface RunnerCreateResult {
runnerCreate: {
runner: (RunnerNode & { ephemeralAuthenticationToken: string | null }) | null;
errors: string[];
} | null;
}
export interface RunnerCreateVars {
input: {
runnerType: string;
groupId?: string | null;
projectId?: string | null;
description?: string | null;
paused?: boolean | null;
locked?: boolean | null;
runUntagged?: boolean | null;
tagList?: string[] | null;
accessLevel?: string | null;
maximumTimeout?: number | null;
maintenanceNote?: string | null;
};
}
export const RUNNER_CREATE: TypedDocumentNode<RunnerCreateResult, RunnerCreateVars> = gql`
mutation RunnerCreate($input: RunnerCreateInput!) {
runnerCreate(input: $input) {
runner {
${RUNNER_FIELDS}
ephemeralAuthenticationToken
}
errors
}
}
`;
// --- Mutation: update a runner (also powers pause/resume via `paused`) ---
export interface RunnerUpdateResult {
runnerUpdate: { runner: RunnerNode | null; errors: string[] } | null;
}
export interface RunnerUpdateVars {
input: {
id: string;
description?: string | null;
paused?: boolean | null;
locked?: boolean | null;
runUntagged?: boolean | null;
tagList?: string[] | null;
accessLevel?: string | null;
maximumTimeout?: number | null;
maintenanceNote?: string | null;
};
}
export const RUNNER_UPDATE: TypedDocumentNode<RunnerUpdateResult, RunnerUpdateVars> = gql`
mutation RunnerUpdate($input: RunnerUpdateInput!) {
runnerUpdate(input: $input) {
runner { ${RUNNER_FIELDS} }
errors
}
}
`;
// --- Mutation: delete a runner ---
export interface RunnerDeleteResult {
runnerDelete: { errors: string[] } | null;
}
export interface RunnerDeleteVars {
input: { id: string };
}
export const RUNNER_DELETE: TypedDocumentNode<RunnerDeleteResult, RunnerDeleteVars> = gql`
mutation RunnerDelete($input: RunnerDeleteInput!) {
runnerDelete(input: $input) {
errors
}
}
`;
|