Skip to content

Add GraphQL subscription for pipeline creation requests

What does this MR do and why?

Adds backend GraphQL infrastructure for real-time pipeline creation status tracking in merge requests. This MR introduces the GraphQL subscription and field that will enable persistent pipeline creation request data that survives page reloads.

This is Part 1 of splitting Persist pipeline creation status across page re... (!207190) • Sahil Sharma into separate backend and frontend MRs, as recommended in this comment to follow best practices.

Related to #568346

Changes

Backend

  • Added pipelineCreationRequests field to MergeRequestType that returns all pipeline creation requests from Redis
  • Created Subscriptions::Ci::PipelineCreationRequestsUpdated GraphQL subscription
  • Added GraphqlTriggers.ci_pipeline_creation_requests_updated to trigger subscription updates
  • Modified MergeRequests::CreatePipelineService to trigger subscription after both sync and async pipeline creation
  • Wrapped subscription trigger behind feature flag ci_pipeline_creation_requests_realtime for safe rollout

How to set up and validate locally

  1. Enable FF ci_pipeline_creation_requests_realtime in rails console:
    Feature.enable(:ci_pipeline_creation_requests_realtime)
  2. Navigate to any merge request with a .gitlab-ci.yml file
  3. Visit http://gdk.test:3000/-/graphql-explorer and use the subscription with your merge request ID:
    subscription {
      ciPipelineCreationRequestsUpdated(mergeRequestId: "gid://gitlab/MergeRequest/YOUR_ID") {
        id
        iid
        pipelineCreationRequests {
          status
          pipelineId
          error
        }
      }
    }
  4. In another tab, click "Run Pipeline" on the merge request
  5. Watch data update in the GraphQL explorer
  6. Disable the feature flag, and ensure that the data is not updated on clicking "Run Pipeline" since the subscription is not being triggered.
    Feature.disable(:ci_pipeline_creation_requests_realtime)

Next Steps

Frontend implementation will follow in a separate MR that:

  • Consumes the new GraphQL subscription
  • Implements the UI for persistent skeleton loaders and error alerts

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sahil Sharma

Merge request reports

Loading