Commit ae1b9ca4 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'fix-merge-trains-cannot-be-retried' into 'master'

Fix retry option doesn't work in Merge Trains

See merge request gitlab-org/gitlab!52463
parents d9b8493c fe6c33d3
...@@ -8,6 +8,7 @@ module Types ...@@ -8,6 +8,7 @@ module Types
connection_type_class(Types::CountableConnectionType) connection_type_class(Types::CountableConnectionType)
authorize :read_pipeline authorize :read_pipeline
present_using ::Ci::PipelinePresenter
expose_permissions Types::PermissionTypes::Ci::Pipeline expose_permissions Types::PermissionTypes::Ci::Pipeline
......
...@@ -367,7 +367,7 @@ module Ci ...@@ -367,7 +367,7 @@ module Ci
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::Build::Factory Gitlab::Ci::Status::Build::Factory
.new(self, current_user) .new(self.present, current_user)
.fabricate! .fabricate!
end end
......
...@@ -960,7 +960,7 @@ module Ci ...@@ -960,7 +960,7 @@ module Ci
def detailed_status(current_user) def detailed_status(current_user)
Gitlab::Ci::Status::Pipeline::Factory Gitlab::Ci::Status::Pipeline::Factory
.new(self, current_user) .new(self.present, current_user)
.fabricate! .fabricate!
end end
......
...@@ -50,3 +50,5 @@ module Ci ...@@ -50,3 +50,5 @@ module Ci
end end
end end
end end
Ci::BuildPresenter.prepend_if_ee('EE::Ci::BuildPresenter')
---
title: Fix retry option does not work in Merge Trains
merge_request: 52463
author:
type: fixed
...@@ -131,10 +131,6 @@ module EE ...@@ -131,10 +131,6 @@ module EE
requirements_report requirements_report
end end
def retryable?
!merge_train_pipeline? && super
end
def ci_secrets_management_available? def ci_secrets_management_available?
return false unless project return false unless project
......
...@@ -89,10 +89,6 @@ module EE ...@@ -89,10 +89,6 @@ module EE
tag? && project_has_subscriptions? tag? && project_has_subscriptions?
end end
def retryable?
!merge_train_pipeline? && super
end
def batch_lookup_report_artifact_for_file_type(file_type) def batch_lookup_report_artifact_for_file_type(file_type)
return unless available_licensed_report_type?(file_type) return unless available_licensed_report_type?(file_type)
......
# frozen_string_literal: true
module EE
module Ci
module BuildPresenter
extend ActiveSupport::Concern
def retryable?
!merge_train_pipeline? && super
end
end
end
end
...@@ -30,6 +30,10 @@ module EE ...@@ -30,6 +30,10 @@ module EE
job_artifact.job.degradation_threshold job_artifact.job.degradation_threshold
end end
end end
def retryable?
!merge_train_pipeline? && super
end
end end
end end
end end
...@@ -468,12 +468,6 @@ RSpec.describe Ci::Build do ...@@ -468,12 +468,6 @@ RSpec.describe Ci::Build do
it { is_expected.to be true } it { is_expected.to be true }
end 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
describe ".license_scan" do describe ".license_scan" do
......
...@@ -463,12 +463,6 @@ RSpec.describe Ci::Pipeline do ...@@ -463,12 +463,6 @@ RSpec.describe Ci::Pipeline do
it { is_expected.to be true } it { is_expected.to be true }
end 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
describe '#merge_train_pipeline?' do describe '#merge_train_pipeline?' do
......
...@@ -14,4 +14,26 @@ RSpec.describe Ci::BuildPresenter do ...@@ -14,4 +14,26 @@ RSpec.describe Ci::BuildPresenter do
'Only users with permission may successfully run this job.' 'Only users with permission may successfully run this job.'
end end
end end
describe '#retryable?' do
subject { presenter.retryable? }
let_it_be(:build) { create(:ci_build, :canceled) }
context 'when the build exists in a pipeline for merge train' do
before do
allow(build).to receive(:merge_train_pipeline?) { true }
end
it { is_expected.to be false }
end
context 'when the build does not exist in a pipeline for merge train' do
before do
allow(build).to receive(:merge_train_pipeline?) { false }
end
it { is_expected.to be true }
end
end
end end
...@@ -188,4 +188,21 @@ RSpec.describe Ci::PipelinePresenter do ...@@ -188,4 +188,21 @@ RSpec.describe Ci::PipelinePresenter do
end end
end end
end end
describe '#retryable?' do
subject { presenter.retryable? }
let!(:build) { create(:ci_build, :canceled, pipeline: pipeline) }
context 'with pipeline for merge train' do
let(:pipeline) { merge_request.all_pipelines.last }
let(:merge_request) { create(:merge_request, :on_train, :with_merge_train_pipeline) }
it { is_expected.to be false }
end
context 'with branch pipeline' do
it { is_expected.to be true }
end
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