Skip to content

graphql: Add merge_request_event_type field to pipeline_type

What does this MR do and why?

This MR adds pipeline.merge_request_event_type to the pipeline_type GraphQL type.

This information is already exposed via the PipelineEntity serializer (eg. /pipelines.json endpoint on a merge request). This brings the same functionality to GraphQL.

This will assist with #336799 (closed).

Screenshots or screen recordings

Screen_Shot_2022-06-03_at_21.38.33

How to set up and validate locally

  1. Enable gitlab-runner on a project
  2. Create a .gitlab-ci.yml file with only: - merge_requests
  3. Create a merge request
  4. Wait for the pipeline to finish
  5. In http://localhost:3000/-/graphql-explorer run:
query {
  project(fullPath:"h5bp/html5-boilerplate") {
    mergeRequest(iid:"7"){
      headPipeline {
        mergeRequestEventType
      }
    }
    pipelines {
      nodes {
        mergeRequestEventType
      }
    }
  }
}

replacing fullPath and iid with your own project path and MR details

  1. See that the merge request event type is present
  2. Run a pipeline against the main branch and repeat the last two steps, see that the merge request event type is null
  3. Enable merge trains on your project
  4. Start a merge train
  5. Repeat graphql step 5 and see the MERGE_TRAIN in the merge request event type

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 #336799 (closed)

Merge request reports