Commit 88df99f1 authored by Sean Carroll's avatar Sean Carroll Committed by Robert Speicher

Hide pipeline retry for Merge Trains

Merge Train pipelines cannot be restarted or they
will fail. This MR hide the retry button.

Closes https://gitlab.com/gitlab-org/gitlab/issues/14853
parent 7079d62a
......@@ -15,7 +15,8 @@ module Ci
:merge_request_ref?,
:source_ref,
:source_ref_slug,
:legacy_detached_merge_request_pipeline?, to: :pipeline
:legacy_detached_merge_request_pipeline?,
:merge_train_pipeline?, to: :pipeline
end
end
end
......@@ -122,6 +122,12 @@ is unavailable when
Follow [this issue](https://gitlab.com/gitlab-org/gitlab/issues/12267) to
track progress on this issue.
### Merge Train Pipeline cannot be retried
A Merge Train pipeline cannot be retried because the merge request is dropped from the merge train upon failure. For this reason, the retry button does not appear next to the pipeline icon.
In the case of pipeline failure, you should [re-enqueue](#how-to-add-a-merge-request-to-a-merge-train) the merge request to the merge train, which will then initiate a new pipeline.
### Merge Train disturbs your workflow
First of all, please check if [merge immediately](#immediately-merge-a-merge-request-with-a-merge-train)
......
......@@ -107,6 +107,10 @@ module EE
metrics_report
end
def retryable?
!merge_train_pipeline? && super
end
private
def name_in?(names)
......
......@@ -98,6 +98,10 @@ module EE
source_bridge&.dependent?
end
def retryable?
!merge_train_pipeline? && super
end
def update_bridge_status!
raise ArgumentError unless bridge_triggered?
raise BridgeStatusError unless source_bridge.active?
......
---
title: Inactivate pipeline retries for Merge Trains
merge_request: 17065
author:
type: added
......@@ -61,6 +61,25 @@ describe 'User adds a merge request to a merge train', :js do
end
end
context 'when pipeline for merge train succeeds' do
before do
visit project_merge_request_path(project, merge_request)
merge_request.merge_train.pipeline.builds.map(&:success!)
end
it 'displays pipeline control' do
expect(page).to have_selector('.mini-pipeline-graph-dropdown-toggle')
end
it 'does not allow retry for merge train pipeline' do
find('.mini-pipeline-graph-dropdown-toggle').click
page.within '.ci-job-component' do
expect(page).to have_selector('.ci-status-icon')
expect(page).not_to have_selector('.retry')
end
end
end
context "when user clicks 'Remove from merge train' button" do
before do
click_link 'Remove from merge train'
......
......@@ -333,4 +333,22 @@ describe Ci::Build do
end
end
end
describe '#retryable?' do
subject { build.retryable? }
let(:pipeline) { merge_request.all_pipelines.last }
let!(:build) { create(:ci_build, :canceled, pipeline: pipeline) }
context 'with pipeline for merged results' do
let(:merge_request) { create(:merge_request, :with_merge_request_pipeline) }
it { is_expected.to be true }
end
context 'with pipeline for merge train' do
let(:merge_request) { create(:merge_request, :on_train, :with_merge_train_pipeline) }
it { is_expected.to be false }
end
end
end
......@@ -527,4 +527,22 @@ describe Ci::Pipeline do
it { is_expected.to be_falsy }
end
end
describe '#retryable?' do
subject { pipeline.retryable? }
let(:pipeline) { merge_request.all_pipelines.last }
let!(:build) { create(:ci_build, :canceled, pipeline: pipeline) }
context 'with pipeline for merged results' do
let(:merge_request) { create(:merge_request, :with_merge_request_pipeline) }
it { is_expected.to be true }
end
context 'with pipeline for merge train' do
let(:merge_request) { create(:merge_request, :on_train, :with_merge_train_pipeline) }
it { is_expected.to be false }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment