Commit 111f9dff authored by Furkan Ayhan's avatar Furkan Ayhan

Remove legacy methods of ci pipeline

These methods are not used anymore after deleting legacy pipeline
processing.

They are replaced by Ci::ProcessPipelineService
parent 101127af
......@@ -733,10 +733,6 @@ module Ci
end
end
def update_legacy_status
set_status(latest_builds_status.to_s)
end
def protected_ref?
strong_memoize(:protected_ref) { project.protected_for?(git_ref) }
end
......@@ -1089,12 +1085,6 @@ module Ci
end
end
def latest_builds_status
return 'failed' unless yaml_errors.blank?
statuses.latest.slow_composite_status(project: project) || 'skipped'
end
def keep_around_commits
return unless project
......
......@@ -57,7 +57,7 @@ class Gitlab::Seeder::Pipelines
BUILDS.each { |opts| build_create!(pipeline, opts) }
EXTERNAL_JOBS.each { |opts| commit_status_create!(pipeline, opts) }
pipeline.update_duration
pipeline.update_legacy_status
::Ci::ProcessPipelineService.new(pipeline).execute
end
end
......
......@@ -63,7 +63,7 @@ RSpec.describe 'test coverage badge' do
create(:ci_pipeline, opts).tap do |pipeline|
yield pipeline
pipeline.update_legacy_status
::Ci::ProcessPipelineService.new(pipeline).execute
end
end
......
......@@ -102,7 +102,7 @@ RSpec.describe Gitlab::Badge::Coverage::Report do
create(:ci_pipeline, opts).tap do |pipeline|
yield pipeline
pipeline.update_legacy_status
::Ci::ProcessPipelineService.new(pipeline).execute
end
end
end
......@@ -2096,58 +2096,6 @@ RSpec.describe Ci::Pipeline, :mailer do
end
end
describe '#update_status' do
context 'when pipeline is empty' do
it 'updates does not change pipeline status' do
expect(pipeline.statuses.latest.slow_composite_status(project: project)).to be_nil
expect { pipeline.update_legacy_status }
.to change { pipeline.reload.status }
.from('created')
.to('skipped')
end
end
context 'when updating status to pending' do
before do
create(:ci_build, pipeline: pipeline, status: :running)
end
it 'updates pipeline status to running' do
expect { pipeline.update_legacy_status }
.to change { pipeline.reload.status }
.from('created')
.to('running')
end
end
context 'when updating status to scheduled' do
before do
create(:ci_build, pipeline: pipeline, status: :scheduled)
end
it 'updates pipeline status to scheduled' do
expect { pipeline.update_legacy_status }
.to change { pipeline.reload.status }
.from('created')
.to('scheduled')
end
end
context 'when statuses status was not recognized' do
before do
allow(pipeline)
.to receive(:latest_builds_status)
.and_return(:unknown)
end
it 'raises an exception' do
expect { pipeline.update_legacy_status }
.to raise_error(Ci::HasStatus::UnknownStatusError)
end
end
end
describe '#detailed_status' do
subject { pipeline.detailed_status(user) }
......
......@@ -364,7 +364,7 @@ RSpec.describe Ci::RetryPipelineService, '#execute' do
stage: "stage_#{stage_num}",
stage_idx: stage_num,
pipeline: pipeline, **opts) do |build|
pipeline.update_legacy_status
::Ci::ProcessPipelineService.new(pipeline).execute
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