Skip to content

Add pipeline name to GraphQL API

Luke Stahlman requested to merge graphql-pipeline-add-name into master

What does this MR do and why?

This MR updates the GraphQL API pipeline type to include the pipeline's name.

How to set up and validate locally

  1. Define a .gitlab-ci.yml file with a pipeline name, for example:
workflow:
  name: 'Test pipeline for $CI_COMMIT_BRANCH'

test:
  script: echo $CI_PIPELINE_NAME
  1. Run a pipeline using the CI config and verify in the UI that the pipeline was assigned a name
  2. In GraphQL explorer, run a query on the project's pipelines and include the name field. Example:
{
  project(fullPath: "path/to/project") {
    pipelines {
      nodes {
        id
        name
        sha
        status
      }
    }
  }
}
  1. Verify the name field is populated. Note: for pipelines with no name, the field will return a null value. Example:
{
  "data": {
    "project": {
      "pipelines": {
        "nodes": [
          {
            "id": "gid://gitlab/Ci::Pipeline/561",
            "name": "Test pipeline for main",
            "sha": "badacbd8cb09c4571f1b53988e6bbfb589f9e004",
            "status": "CREATED"
          }
        ]
      }
    }
  }
}

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 Luke Stahlman

Merge request reports