# Gets a pipeline via its identifier. You can locate the pipeline identifier in # the general settings for the pipeline query GetPipelineById($id: ID!) { node(id: $id) { __typename ... on Pipeline { id name slug description repository { url } } } } # Get all of the currently running builds and the commits they are running on, # as a faster way to get all of the builds we are interested in query GetRunningBuilds($id: ID!) { node(id: $id) { __typename ... on Pipeline { builds(first: 100, state: [RUNNING, FAILING]) { count edges { node { uuid commit } } } } } } # There is a window between a job finishing and the build finishing # where we could miss the exit status of the job, so do an additional # query with all all of the builds that are still running, as well # as any builds that have failed since we last checked query GetBuilds($id: ID!, $commits: [String!]) { node(id: $id) { __typename ... on Pipeline { builds(first: 100, commit: $commits, state: [RUNNING, FAILING, FAILED]) { count edges { node { uuid message state commit metaData(first: 10) { count edges { node { key value } } } triggeredFrom { build { uuid metaData(first: 10) { count edges { node { key value } } } } } jobs(first: 100) { count edges { node { __typename ... on JobTypeCommand { uuid label state agentQueryRules exitStatus agent { name } } } } pageInfo { hasNextPage } } } } } } } } # Gets (hopefully) all of the currently scheduled jobs that are ready # to be executed, but are waiting on an agent to pick them up. This also # retrieves a few details from the parent Build that the job is a part of query GetCurrentJobs($id: ID!) { node(id: $id) { __typename ... on Pipeline { jobs(state: [SCHEDULED, RUNNING, ACCEPTED, ASSIGNED], type: [COMMAND], first: 500) { count edges { node { __typename ... on JobTypeCommand { uuid label state agentQueryRules agent { name } build { uuid metaData(first: 10) { count edges { node { key value } } } } } } } pageInfo { hasNextPage } } } } }