GraphQL: Add support for retrieving project jobs with given name/stage
What does this MR do and why?
Describe in detail what your merge request does and why.
This MR adds support for retrieving jobs with a given name
/stage
from a project.
NOTE: Adding a ci_builds
index triggers a Rubocop warning which I disabled here. Link: #332886 (closed)
Related issues
- blocker Review indexes on `ci_builds` (#295478)
- Jobs API - Filter on name (#22027)
- API: jobs endpoint should have more filtering o... (#353168 - closed)
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
{
project(fullPath:"gnuwget/Wget2") {
id
jobs(last:20, statuses:[SUCCESS], stageName:"deploy", name:"staging") {
nodes {
id
name
duration
}
}
}
}
Result
{
"data": {
"project": {
"id": "gid://gitlab/Project/3",
"jobs": {
"nodes": [
{
"id": "gid://gitlab/Ci::Build/829",
"name": "staging",
"duration": 21619
},
{
"id": "gid://gitlab/Ci::Build/812",
"name": "staging",
"duration": 21619
},
{
"id": "gid://gitlab/Ci::Build/795",
"name": "staging",
"duration": 21618
},
{
"id": "gid://gitlab/Ci::Build/778",
"name": "staging",
"duration": 21618
},
{
"id": "gid://gitlab/Ci::Build/761",
"name": "staging",
"duration": 21618
},
{
"id": "gid://gitlab/Ci::Build/744",
"name": "staging",
"duration": 21617
},
{
"id": "gid://gitlab/Ci::Build/727",
"name": "staging",
"duration": 21617
},
{
"id": "gid://gitlab/Ci::Build/710",
"name": "staging",
"duration": 21617
},
{
"id": "gid://gitlab/Ci::Build/693",
"name": "staging",
"duration": 21616
},
{
"id": "gid://gitlab/Ci::Build/676",
"name": "staging",
"duration": 21616
},
{
"id": "gid://gitlab/Ci::Build/659",
"name": "staging",
"duration": 21616
},
{
"id": "gid://gitlab/Ci::Build/642",
"name": "staging",
"duration": 21615
},
{
"id": "gid://gitlab/Ci::Build/625",
"name": "staging",
"duration": 21615
},
{
"id": "gid://gitlab/Ci::Build/608",
"name": "staging",
"duration": 21615
},
{
"id": "gid://gitlab/Ci::Build/591",
"name": "staging",
"duration": 21614
},
{
"id": "gid://gitlab/Ci::Build/574",
"name": "staging",
"duration": 21614
}
]
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Pedro Pombeiro