Skip to content

GraphQL: Add RunnerJobCountResolver

What does this MR do and why?

NOTE: This MR has no changelog because the fields being added to GraphQL are all marked as alpha. The goal is to allow some frontend code to be added without having users tie us to this exact API for the time being.

This MR adds a statuses argument to the CiRunner.jobCount field, by way of a dedicated GraphQL resolver. This allows filtering the counts given the list of statuses. If no statuses are specified, the total count of jobs is returned, as before.

Part of #377324 (closed) and #416763 (closed)

Screenshots or screen recordings

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

Before After
image image

How to set up and validate locally

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

  1. Go to the shell in your GDK gitlab directory and run bundle exec rake "gitlab:seed:runner_fleet". This will seed your GDK with some runners and jobs required for testing this MR.

  2. Open http://gdk.test:3000/-/graphql-explorer

  3. Enter the following query:

    {
      runners(type: INSTANCE_TYPE, last: 5) {
        count
        nodes {
          id
          failedJobs: jobCount(statuses: [FAILED])
          successfulJobs: jobCount(statuses: [SUCCESS])
          unfinishedJobs: jobCount(statuses: [PENDING, RUNNING])
        }
      }
    }

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