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
pipelineCreationRequestsfield toMergeRequestTypethat returns all pipeline creation requests from Redis - Created
Subscriptions::Ci::PipelineCreationRequestsUpdatedGraphQL subscription - Added
GraphqlTriggers.ci_pipeline_creation_requests_updatedto trigger subscription updates - Modified
MergeRequests::CreatePipelineServiceto trigger subscription after both sync and async pipeline creation - Wrapped subscription trigger behind feature flag
ci_pipeline_creation_requests_realtimefor safe rollout
How to set up and validate locally
- Enable FF
ci_pipeline_creation_requests_realtimein rails console:Feature.enable(:ci_pipeline_creation_requests_realtime) - Navigate to any merge request with a
.gitlab-ci.ymlfile - 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 } } } - In another tab, click "Run Pipeline" on the merge request
- Watch data update in the GraphQL explorer
- 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