Add jobs graphql endpoint
What does this MR do and why?
This MR adds a new graphql endpoint
jobs
.
Is a part of this feature, that consists of several MRs. Read this comment
Related Issues:
Same feature asked for REST API (Just to show how badly people want this feature)
We would like to have a filter for 'jobs' in the admin area. To stay consistent and since GitLab is making a switch to vue.js
, the implementation should be based on the jobs filter in Project > CI/CD > Jobs
. The implementation in projects-area fetches the data via graphql in the form of:
query {
project(fullPath: $fullPath) {
id
jobs {
nodes {
...
}
}
}
}
In the admin area, all jobs
are now also to be queried via the new graphql endpoint
in the form of:
query{
jobs(after: $after, first: $first, statuses: $statuses){
...
}
}
}
How to set up and validate locally
- go to http://your-gitlab-instance/-/graphql-explorer or https://your-gitlab-instance/-/graphql-explorer
- Test this query:
query{
jobs{
count,
nodes{
id
}
}
}
- You should receive data like:
{
"data": {
"jobs": {
"count": 854,
"nodes": [
{
"id": "gid://gitlab/Ci::Build/906"
},
{
"id": "gid://gitlab/Ci::Build/905"
},
...
- Impersonate a user who is not admin
- Repeat 2
- You should receive data like:
{
"data": {
"jobs": {
"count": 0,
"nodes": []
}
}
}
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.