Commit bf990fcd authored by Grzegorz Bizon's avatar Grzegorz Bizon

Return false in create_builds if not builds created

This fixes compatibility with trigger request create service.
parent cf292a3f
...@@ -91,7 +91,7 @@ module Ci ...@@ -91,7 +91,7 @@ module Ci
trigger_requests.any? trigger_requests.any?
end end
def build_builds(user, status = 'success', trigger_request = nil) def build_builds(user, trigger_request = nil, status = 'success')
return unless config_processor return unless config_processor
config_processor.stages.any? do |stage| config_processor.stages.any? do |stage|
build_builds_for_stage(stage, user, status, trigger_request).present? build_builds_for_stage(stage, user, status, trigger_request).present?
...@@ -99,8 +99,7 @@ module Ci ...@@ -99,8 +99,7 @@ module Ci
end end
def create_builds(user, trigger_request = nil) def create_builds(user, trigger_request = nil)
build_builds(user, 'success', trigger_request) build_builds(user, trigger_request) && save
save
end end
def create_next_builds(build) def create_next_builds(build)
......
...@@ -258,6 +258,16 @@ describe Ci::Pipeline, models: true do ...@@ -258,6 +258,16 @@ describe Ci::Pipeline, models: true do
end end
end end
end end
context 'when no builds created' do
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
end
end
end end
describe "#finished_at" do describe "#finished_at" do
......
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