Add merge_request_iid support to PipelineCreate mutation
What does this MR do and why?
Adds merge_request_iid support to PipelineCreate mutation to create pipelines associated with merge requests through the GraphQL
When merge_request_iid is provided:
- The mutation finds the merge request by IID
- Passes it to Ci::CreatePipelineService
- Creates a pipeline linked to the merge request
This MR adds the backend changes required to make the frontend changes in !225516 (merged) functional, which adds the ability to create MR pipelines with inputs.
References
Relates to #547861
How to set up and validate locally
- Verify the entire flow using the frontend changes at !225516 (merged) OR the following
- Enable the feature flag:
Feature.enable(:enable_inputs_for_mr_pipelines) - Create a test merge request (or use an existing one):
- Note the project path and MR IID
- Ensure the project has a valid .gitlab-ci.yml
- Create a pipeline for an MR:
mutation {
pipelineCreate(input: {
projectPath: "your-group/your-project"
ref: "feature-branch"
mergeRequestIid: "123"
}) {
pipeline {
id
iid
source
mergeRequest {
iid
}
}
errors
}
}
- Verify the response:
- pipeline.source should be "merge_request_event"
- pipeline.mergeRequest.iid should match the provided IID
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.
Related to #547861
Edited by Tarun Raja