Skip to content

Add pipeline lists to graphql

Bob Van Landuyt requested to merge bvl-graphql-pipeline-lists into master

What does this MR do?

This adds paginated fields to GraphQL's ProjectType and MergeRequestType to allow fetching pipelines for those resources.

The queries for those could look like this:

project(fullPath: $project_path) {
  pipelines(first: 2) {
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
    edges {
      cursor
      node {
        id
        status
      }
    }
  }
}

The returned data would then look like this:

{
  "data": {
    "project": {
      "pipelines": {
        "pageInfo": {
          "hasNextPage": true,
          "hasPreviousPage": false
        },
        "edges": [
          {
            "cursor": "Nzc=",
            "node": {
              "id": "77",
              "status": "FAILED"
            }
          },
          {
            "cursor": "Njc=",
            "node": {
              "id": "67",
              "status": "FAILED"
            }
          }
        ]
      }
    }
  }

the pageInfo field contains whether or not the client should keep fetching pages. While the edges array contains information about the elements in the collection:

  • cursor is a base64 encoded version of the field that is used for ordering (by default, the primary key).
  • node contains the requested information about the resource.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/48469

Edited by Bob Van Landuyt

Merge request reports