Skip to content
Snippets Groups Projects
Commit 2d495fce authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Remove reduntant method for building pipeline builds

parent 69112072
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -91,15 +91,14 @@ module Ci
trigger_requests.any?
end
 
def build_builds(user, trigger_request = nil)
def create_builds(user, trigger_request = nil)
##
# We persist pipeline only if there are builds available
#
return unless config_processor
 
build_builds_for_stages(config_processor.stages, user,
'success', trigger_request)
end
def create_builds(user, trigger_request = nil)
build_builds(user, trigger_request) && save
'success', trigger_request) && save
end
 
def create_next_builds(build)
Loading
Loading
@@ -121,7 +120,6 @@ module Ci
# and save pipeline if we have builds
build_builds_for_stages(next_stages, build.user, prior_status,
build.trigger_request) && save
end
 
def retried
Loading
Loading
Loading
Loading
@@ -22,7 +22,8 @@ module Ci
 
# don't create the same build twice
builds_attrs.reject! do |build_attrs|
@pipeline.builds.find_by(ref: @pipeline.ref, tag: @pipeline.tag,
@pipeline.builds.find_by(ref: @pipeline.ref,
tag: @pipeline.tag,
trigger_request: trigger_request,
name: build_attrs[:name])
end
Loading
Loading
Loading
Loading
@@ -42,7 +42,7 @@ class CreateCommitBuildsService
##
# Skip creating pipeline object if there are no builds for it.
#
unless @pipeline.build_builds(user)
unless @pipeline.create_builds(user)
@pipeline.errors.add(:base, 'No builds created')
return false
end
Loading
Loading
Loading
Loading
@@ -260,12 +260,15 @@ describe Ci::Pipeline, models: true do
end
 
context 'when no builds created' do
let(:pipeline) { build(:ci_pipeline) }
before do
stub_ci_pipeline_yaml_file(YAML.dump(before_script: ['ls']))
end
 
it 'returns false' do
expect(pipeline.create_builds(nil)).to be_falsey
expect(pipeline).not_to be_persisted
end
end
end
Loading
Loading
Loading
Loading
@@ -184,6 +184,7 @@ describe CreateCommitBuildsService, services: true do
before: '00000000',
after: '31das312',
commits: [{ message: 'some msg' }])
expect(result).to be_falsey
expect(Ci::Build.all).to be_empty
expect(Ci::Pipeline.count).to eq(0)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment