Skip to content

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

  1. go to http://your-gitlab-instance/-/graphql-explorer or https://your-gitlab-instance/-/graphql-explorer
  2. Test this query:
query{
  jobs{
    count,
    nodes{
      id
    }
  }
}
  1. You should receive data like:
{
  "data": {
    "jobs": {
      "count": 854,
      "nodes": [
        {
          "id": "gid://gitlab/Ci::Build/906"
        },
        {
          "id": "gid://gitlab/Ci::Build/905"
        },
...
  1. Impersonate a user who is not admin
  2. Repeat 2
  3. You should receive data like:
{
  "data": {
    "jobs": {
      "count": 0,
      "nodes": []
    }
  }
}

🛠 with at Siemens

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 Andreas Deicha

Merge request reports

Loading