Consider enabling Merge Train in `gitlab-org/gitlab` project MRs
Problem
It seems there are some cases that were able to avoid master:broken if we set pipeline:run-all-rspec in the MR before the merge. For example:
I wonder if we should always run full-fledged pipeline when we are about to merge an MR (i.e. the last pipeline before the merge). So that we don't need to go the lengthy revert and incident process when a master is broken, which requires efforts from incident managers, delivery teams, QA and operators. This organizational human-operating cost could be more concerning than the actual pipeline running cost.
Proposal
- Enable Merge Trains.
- Adjust the .gitlab-ci.yml. e.g.
diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml
index 7f0de878744..1f06a6449bb 100644
--- a/.gitlab/ci/rules.gitlab-ci.yml
+++ b/.gitlab/ci/rules.gitlab-ci.yml
@@ -63,6 +63,7 @@
.if-merge-request-labels-run-all-rspec: &if-merge-request-labels-run-all-rspec
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-all-rspec/'
+ if: $CI_MERGE_REQUEST_EVENT_TYPE == "merge_train"
.if-merge-request-labels-run-all-jest: &if-merge-request-labels-run-all-jest
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-all-jest/'
(This proposed change should be properly refactored)
There are additional benefits that we can simplify the merging a merge request by removing practices, such as "2 hour rule" and "pipeline before approval":
Start a new merge request pipeline with the Run pipeline button in the merge request’s “Pipelines” tab, and enable “Merge When Pipeline Succeeds” (MWPS). Note that:
- If the default branch is broken, do not merge the merge request except for very specific cases. For other cases, follow these handbook instructions.
- If the latest pipeline was created before the merge request was approved, start a new pipeline to ensure that full RSpec suite has been run. You may skip this step only if the merge request does not contain any backend change.
- If the latest merged results pipeline finished less than 2 hours ago, you may merge without starting a new pipeline as the merge request is close enough to main.
Maintainers can always click "Add to merge train" button, as the Merge Train ensures that the full-fledged pipeline always run right before the merge.