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