Design: Automatically create a new merge request pipeline when a draft MR is marked as ready
Workaround
Release notes
Problem to solve
Developers often start an MR early in feature development to make it easier to collaborate on the proposed implementation. It doesn't make sense to run costly tests and the full pipeline for Draft MR commits.
The common workflow is as follows:
- work in branch with opened MR in a draft state (detached pipelines will be created)
- after work is done - resolve draft status (mark the MR as read in the UI or by changing the description)
this is when the merged results pipeline should be created
- merge after pipeline for merged result succeeded
Developers would like to have a pipeline automatically created when the draft MR is marked as ready. Reason for that - code for detached pipelines may differ from merged requests pipelines, so developers need to re-run tests on it before allowing MR to be merged.
Further details
we would get this feature working "for free" and out-of-the box if we ship GitLab CI Workflows. I have my PoC ready here: !91244 (closed). See demo: https://youtu.be/cwfRI9m3rRs
WIP Proposal
- If the pipelines running in
DRAFT
state are different from the pipelines running for aREADY
MR, automatically create a new pipeline when an MR changes state fromDRAFT
toREADY
.
Mark MR as "ready" |
---|
![]() ![]() |
Further details
Implementation details
WIP events are handled by:
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/controllers/projects/merge_requests_controller.rb#L248-254
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/services/merge_requests/update_service.rb
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/services/merge_requests/base_service.rb#L75-79
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/services/issuable_base_service.rb#L187
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/services/merge_requests/update_service.rb#L128-142
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/services/merge_requests/base_service.rb#L81-85
- https://gitlab.com/gitlab-org/gitlab/-/blob/c7bfa18f7b6f60d79d93f6c5423f27d20e701df3/app/services/merge_requests/base_service.rb#L87-96
Somewhere along this call chain we should introduce a call to MergeRequests::CreatePipelineService
Intended users
Feature Usage Metrics
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.