Skip to content

Add scope parameter to Project.pipelines query

What does this MR do and why?

This adds the ability to filter pipelines by their scope via the Project.pipelines GraphQL query.

This is needed as part of &6637 (closed) where we are implementing a page where on-demand scans are rendered in tabs. One of these tabs is Finished where we want to show all tabs that either succeeded, failed, or were canceled. We are using the Project.pipelines endpoint along with the source filter to get the relevant pipelines. The endpoint currently supports a status filter, but it accepts a single value at a time, which isn't sufficient in our case.

One option would be to add the ability to filter by multiple statuses, but since we already have a by_scope filter in the pipelines finder, we might as well expose it as a GraphQL variable. The finished scope seems to do exactly what we need.

Screenshots or screen recordings

Fetching finished scans

Screen_Shot_2021-11-11_at_6.41.47_PM

Fetching running scans

Screen_Shot_2021-11-11_at_6.42.33_PM

How to set up and validate locally

  1. Open GraphiQL at http://gdk.test:3000/-/graphql-explorer.
  2. Run a query with the scope filter set. For example:
query PipelinesByScope {
  project(fullPath: "gitlab-org/dast_scans") {
    pipelines(scope: RUNNING) {
      count
      nodes {
        id
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #341373 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports