Skip to content

Draft: Add pipeline status to GraphQL projects query

Peter Hegman requested to merge add-pipline-status-to-graphql-query into master

What does this MR do and why?

Related to #482803

In &13066 we are moving Your work -> Projects to Vue and using GraphQL as the data source. We need to be able to get the pipeline status for projects from the GraphQL query but this is not possible at the moment. This MR adds a lastest_pipeline_detailed_status field that returns detailed pipeline status for the latest pipeline.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

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

Before After

How to set up and validate locally

  1. Open rails console (bin/rails console)
  2. Clear pipeline cache
projects = Project.all
projects.each { |project| Gitlab::Cache::Ci::ProjectPipelineStatus.new(project).delete_from_cache }
  1. Go to http://gdk.test:3000/-/graphql-explorer
  2. Open the dev tools and go to Network tab
  3. Run this query (make sure you have a project with a pipeline)
query getProjects {
  projects(membership: true) {
    nodes {
      nameWithNamespace
      lastestPipelineDetailedStatus {
        name
        label
      }
    }
  }
}
  1. Copy the x-request-id header
  2. Go to http://gdk.test:3000/
  3. In the upper right corner of performance bar, click the + symbol and pasted the request ID
  4. Choose request from dropdown
  5. Run the query again without clearing pipeline cache to see cached result
Edited by Peter Hegman

Merge request reports

Loading