Remove code deprecated in pipeline process service
This commit is contained in:
parent
9fc17f6f4a
commit
ca12079ac8
|
@ -5,8 +5,6 @@ module Ci
|
|||
def execute(pipeline)
|
||||
@pipeline = pipeline
|
||||
|
||||
ensure_created_builds! # TODO, remove me in 9.0
|
||||
|
||||
new_builds =
|
||||
stage_indexes_of_created_builds.map do |index|
|
||||
process_stage(index)
|
||||
|
@ -73,18 +71,5 @@ module Ci
|
|||
def created_builds
|
||||
pipeline.builds.created
|
||||
end
|
||||
|
||||
# This method is DEPRECATED and should be removed in 9.0.
|
||||
#
|
||||
# We need it to maintain backwards compatibility with previous versions
|
||||
# when builds were not created within one transaction with the pipeline.
|
||||
#
|
||||
def ensure_created_builds!
|
||||
return if created_builds.any?
|
||||
|
||||
Ci::CreatePipelineBuildsService
|
||||
.new(project, current_user)
|
||||
.execute(pipeline)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -418,65 +418,6 @@ describe Ci::ProcessPipelineService, '#execute', :services do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when there are builds that are not created yet' do
|
||||
let(:pipeline) do
|
||||
create(:ci_pipeline, config: config)
|
||||
end
|
||||
|
||||
let(:config) do
|
||||
{ rspec: { stage: 'test', script: 'rspec' },
|
||||
deploy: { stage: 'deploy', script: 'rsync' } }
|
||||
end
|
||||
|
||||
before do
|
||||
create_build('linux', stage: 'build', stage_idx: 0)
|
||||
create_build('mac', stage: 'build', stage_idx: 0)
|
||||
end
|
||||
|
||||
it 'processes the pipeline' do
|
||||
# Currently we have five builds with state created
|
||||
#
|
||||
expect(builds.count).to eq(0)
|
||||
expect(all_builds.count).to eq(2)
|
||||
|
||||
# Process builds service will enqueue builds from the first stage.
|
||||
#
|
||||
process_pipeline
|
||||
|
||||
expect(builds.count).to eq(2)
|
||||
expect(all_builds.count).to eq(2)
|
||||
|
||||
# When builds succeed we will enqueue remaining builds.
|
||||
#
|
||||
# We will have 2 succeeded, 1 pending (from stage test), total 4 (two
|
||||
# additional build from `.gitlab-ci.yml`).
|
||||
#
|
||||
succeed_pending
|
||||
process_pipeline
|
||||
|
||||
expect(builds.success.count).to eq(2)
|
||||
expect(builds.pending.count).to eq(1)
|
||||
expect(all_builds.count).to eq(4)
|
||||
|
||||
# When pending merge_when_pipeline_succeeds in stage test, we enqueue deploy stage.
|
||||
#
|
||||
succeed_pending
|
||||
process_pipeline
|
||||
|
||||
expect(builds.pending.count).to eq(1)
|
||||
expect(builds.success.count).to eq(3)
|
||||
expect(all_builds.count).to eq(4)
|
||||
|
||||
# When the last one succeeds we have 4 successful builds.
|
||||
#
|
||||
succeed_pending
|
||||
process_pipeline
|
||||
|
||||
expect(builds.success.count).to eq(4)
|
||||
expect(all_builds.count).to eq(4)
|
||||
end
|
||||
end
|
||||
|
||||
def process_pipeline
|
||||
described_class.new(pipeline.project, user).execute(pipeline)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue