Skip to content

Measure the impact of using merge request specific ref (`refs/merge-requests/:iid/head`)

Tl;dr;

This issue is preliminary work for https://gitlab.com/gitlab-org/gitlab-ee/issues/7380. This issue has to be solved either way and considered as a checkpoint in the big picture.

Problem to Solve

Currently, GitLab Runner can fetch source code from only branch/tag refs, such as refs/heads/branch_name or refs/tags/tag_name. However, in order to support https://gitlab.com/gitlab-org/gitlab-ee/issues/7380 workflow, GitLab Runner has to be able to fetch source code from custom refs.

Today, we have a custom ref on the merge request context. This ref is formatted refs/merge-requests/:iid/head and it points to the HEAD sha of the source branch. We should use this ref sooner than later because it's quite breaking change as it could break the other functionlities e.g. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25504#note_145792438. We should measure the impact before we stepping into https://gitlab.com/gitlab-org/gitlab-ee/issues/7380, which uses refs/merge-requests/:iid/merge ref.

Design and design requirements

FE design specs!

💎 specs

Merge request widget

Relies on the same logic that would be implemented with https://gitlab.com/gitlab-org/gitlab-ce/issues/40246

Requirements Mockups
Merge request is merge-able
  • We will show merge widget as normal (no changes)
Merge request is not merge-able
  • We will show merge widget as normal (no changes)
Merge request is being merged
  • Merge button has spinner and states Merging (no changes)
Fork merge request
  • Warning Merge request pipelines are enabled but will not activate due to this being a fork merge request
  • Warning merge button (Merge when pipeline succeeds will also be warning colored as we rely on a normal branch pipeline in those cases)
fork
Invalid merge request as target-branch advanced (linear history)
  • merge button disabled
  • warning target branch has advanced, update source branch and retry merge
invalid-prospective-merge-pipeline-target-branch-advanced-linear
Invalid merge request pipeline as target-branch advanced (non-linear history)
  • merge when pipeline succeeds button (which triggers new pipeline when pressed)
  • warning target branch has advanced, retry merge
invalid-prospective-merge-pipeline-target-branch-advanced-non-linear
Merge request pipeline failed
  • merge when pipeline succeeds button (which triggers new pipeline when pressed)
  • warning pipeline failed, retry merge or fix failure
prospective-merge-pipeline-failed
Merge request is converted from WIP to non-WIP
  • Merge request pipeline is automatically triggered
  • merge when pipeline succeeds button is shown (no changes)
Merge request widget pipeline block
Requirements Mockups
Normal branch pipeline
  • Unchanged
normal_pipeline
Detached merge request pipeline
  • Ref now shows merge request ID/Link before the source branch
prospective-merge-pipeline-failed_copy_6
Merged result merge request pipeline
  • Ref now shows merge request ID/Link before source branch and adds target branch
prospective-merge-pipeline-failed_copy_7

Pipeline list view

Requirements Mockups
Normal branch pipeline
  • Ref unchanged
image
Detached merge request pipeline
  • Ref now shows merge request ID/Link
  • merge request tag is removed
  • Detached tag is added
image
Merged result merge request pipeline
  • Ref now shows merge request ID/Link
  • merge request tag is removed
image

Pipeline detail view widget

Requirements Mockups
Normal branch pipeline
  • Copy from changed to for
normal_pipeline_copy
Detached merge request pipeline
  • Ref now shows merge request ID/Link before the source branch
  • merge request tag is removed
  • Detached tag is added
  • Copy from changed to for
normal_pipeline_copy_2
Merged result merge request pipeline
  • Ref now shows merge request ID/Link before source branch and adds target branch
  • merge request tag is removed
  • Copy from changed to for
normal_pipeline_copy_3

Job detail view sidebar

Requirements Mockups
Normal branch pipeline
  • Copy from changed to for
image
Detached merge request pipeline
  • Ref now shows merge request ID/Link before the source branch
  • Copy from changed to for
image
Merged result merge request pipeline
  • Ref now shows merge request ID/Link before source branch and adds target branch
  • Copy from changed to for
image

Merge request list view

Requirements Mockups
  • Pipeline status will include normal pipeline statuses, merge request pipelines statusses, merge request pipeline statuses, and post merge pipeline statusses, which ever one is the latest and thus most important
image

Project settings merge request settings

Requirements Mockups
  • Added option for enabling merge request pipelines for merged result
  • Restructured content (FE only, as same checkboxes still apply)
project-settings

Put the feature behind the feature flag

ci_detached_pipeline

Edited by Dimitrie Hoekstra