Skip to content
Snippets Groups Projects

Build cascading train refs for parallel execution of Pipelines for merge trains

Merged Shinya Maeda requested to merge run-pipeline-for-merge-trains-on-train-ref into master
All threads resolved!

What does this MR do?

As we supported arbitrary refs creation in the previous merge request https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14298, we can now create cascading merge refs in refs/train to run Pipelines for merge trains in parallel.

In this iteration, we support up-to 4 concurrent pipeline runs. Here is the overview of the process flow:

  1. User adds MR1, MR2, MR3, MR4 and MR5 to a train.
  2. The system creates the train ref refs/merge-requests/1/train from mr1.diff_head_sha and mr1.target_branch_ref.
  3. The system creates a pipeline run on refs/merge-requests/1/train.
  4. The system creates the train ref refs/merge-requests/2/train from mr2.diff_head_sha and mr1.train_ref_path.
  5. The system creates a pipeline run on refs/merge-requests/2/train.
  6. The system creates the train ref refs/merge-requests/3/train from mr3.diff_head_sha and mr2.train_ref_path.
  7. The system creates a pipeline run on refs/merge-requests/3/train.
  8. The system creates the train ref refs/merge-requests/4/train from mr4.diff_head_sha and mr3.train_ref_path.
  9. The system creates a pipeline run on refs/merge-requests/4/train.
  10. The system does not create any train refs refs/merge-requests/5/train because it's out of concurrency factor.
  11. The system does not create any pipelines on refs/merge-requests/5/train because it's out of concurrency factor.

Related https://gitlab.com/gitlab-org/gitlab-ee/issues/11222 gitaly!1210 (merged)

Feature Flag

This behavior can be reverted by Feature.disable(:merge_trains_parallel_pipelines). After it's reverted, pipeline runs one at a time.

Extra datapoint

Today the number of projects which enables merge trains is still very low.

gitlabhq_production=> select COUNT(*) from project_ci_cd_settings WHERE merge_trains_enabled = true;
 count 
-------
    28
(1 row)

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Couple questions and suggestions, thanks @dosuken123!

  • Oswaldo Ferreira assigned to @dosuken123 and unassigned @oswaldo

    assigned to @dosuken123 and unassigned @oswaldo

  • Shinya Maeda added 199 commits

    added 199 commits

    Compare with previous version

  • Shinya Maeda resolved all discussions

    resolved all discussions

  • Shinya Maeda added 1 commit

    added 1 commit

    • dfb5ad8f - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 116 commits

    added 116 commits

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • cc4cd0a1 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda mentioned in merge request !14495 (merged)

    mentioned in merge request !14495 (merged)

  • mentioned in issue #12562 (closed)

  • Shinya Maeda mentioned in merge request gitaly!1210 (merged)

    mentioned in merge request gitaly!1210 (merged)

  • Shinya Maeda added 1132 commits

    added 1132 commits

    Compare with previous version

  • Shinya Maeda changed target branch from create-merge-train-ref to run-pipeline-for-merge-train-at-train-ref

    changed target branch from create-merge-train-ref to run-pipeline-for-merge-train-at-train-ref

  • Shinya Maeda added 1 commit

    added 1 commit

    • 17371132 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda changed title from {-Create refs/train for-} Pipelines for merge trains to Build cascading train refs for parallel execution of Pipelines for merge trains

    changed title from {-Create refs/train for-} Pipelines for merge trains to Build cascading train refs for parallel execution of Pipelines for merge trains

  • Shinya Maeda added 1 commit

    added 1 commit

    • b0813bff - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • 705b6f14 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • 7c72da76 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • d4f9754d - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda changed target branch from run-pipeline-for-merge-train-at-train-ref to master

    changed target branch from run-pipeline-for-merge-train-at-train-ref to master

  • Shinya Maeda added 91 commits

    added 91 commits

    Compare with previous version

  • Shinya Maeda added 19 commits

    added 19 commits

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • cc4f1765 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda changed the description

    changed the description

  • Shinya Maeda added 1 commit

    added 1 commit

    • e7f5876f - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • f2dcd4c0 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda marked the checklist item Changelog entry as completed

    marked the checklist item Changelog entry as completed

  • Shinya Maeda marked the checklist item Code review guidelines as completed

    marked the checklist item Code review guidelines as completed

  • Shinya Maeda marked the checklist item Merge request performance guidelines as completed

    marked the checklist item Merge request performance guidelines as completed

  • Shinya Maeda marked the checklist item Style guides as completed

    marked the checklist item Style guides as completed

  • Shinya Maeda marked the checklist item Database guides as completed

    marked the checklist item Database guides as completed

  • Shinya Maeda marked the checklist item Separation of EE specific content as completed

    marked the checklist item Separation of EE specific content as completed

  • Shinya Maeda changed the description

    changed the description

  • Shinya Maeda added 1 commit

    added 1 commit

    • 9283b9b0 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda assigned to @ayufan and unassigned @dosuken123

    assigned to @ayufan and unassigned @dosuken123

  • Shinya Maeda assigned to @dosuken123 and unassigned @ayufan

    assigned to @dosuken123 and unassigned @ayufan

  • assigned to @ayufan

  • Shinya Maeda added 281 commits

    added 281 commits

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • 0bc462db - Create refs/train and run a pipeline on it

    Compare with previous version

  • mentioned in issue #11222 (closed)

  • Shinya Maeda added 1 commit

    added 1 commit

    • c0de9c02 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • bc8b10be - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 182 commits

    added 182 commits

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • 518c9530 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • e0cb5f2e - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda resolved all threads

    resolved all threads

  • Author Maintainer

    @smcgivern Would you mind reviewing as a backend maintainer? Thanks.

  • Shinya Maeda assigned to @smcgivern and unassigned @ayufan and @dosuken123

    assigned to @smcgivern and unassigned @ayufan and @dosuken123

  • Shinya Maeda changed the description

    changed the description

  • Author Maintainer

    Manual QA at Thu Jul 11 12:28:37 UTC 2019

    Based on the https://gitlab.com/gitlab-org/gitlab-ee/issues/11222#note_190356236's conditions, I performed manual QA to the following cases:

    Case 1: MR1 was merged into master branch.

    Expectation:

    • MR2 does not re-create pipeline for merge train.
    • MR2 is merged after the current pipeline succeeded.

    Result: Pass

    Case 2: MR1 was dropped from the merge train.

    Expectation:

    • MR2 re-creates a pipeline for merge train.
    • MR2 is merged after the recreated pipeline succeeded.

    Result: Pass

    Case 3: An emergent patch has been merged into master.

    Expectation:

    • Both MR1 and MR2 re-create a pipeline for merge train.
    • MR1 is merged after the recreated pipeline succeeded.
    • MR2 is merged after MR1 has been merged and the recreated pipeline succeeded.

    Result: Pass

  • Shinya Maeda added 1 commit

    added 1 commit

    • 59e18c87 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 107 commits

    added 107 commits

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • 166c4ed3 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Sean McGivern
  • Thanks @dosuken123! Nothing major.

  • Sean McGivern assigned to @dosuken123 and unassigned @smcgivern

    assigned to @dosuken123 and unassigned @smcgivern

  • Shinya Maeda resolved all threads

    resolved all threads

  • Shinya Maeda added 98 commits

    added 98 commits

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • e3013a9b - Create refs/train and run a pipeline on it

    Compare with previous version

  • Author Maintainer

    @smcgivern Thanks. Back to you!

  • Shinya Maeda assigned to @smcgivern and unassigned @dosuken123

    assigned to @smcgivern and unassigned @dosuken123

  • Oswaldo Ferreira
  • Shinya Maeda resolved all threads

    resolved all threads

  • Shinya Maeda added 1 commit

    added 1 commit

    • b5ac43d6 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda resolved all threads

    resolved all threads

  • Shinya Maeda added 1 commit

    added 1 commit

    • 34b30a29 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Shinya Maeda added 1 commit

    added 1 commit

    • 39a90598 - Create refs/train and run a pipeline on it

    Compare with previous version

  • Sean McGivern approved this merge request

    approved this merge request

  • merged

  • Thanks @dosuken123!

  • Sean McGivern mentioned in commit aecb4072

    mentioned in commit aecb4072

  • Please register or sign in to reply
    Loading