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
trigger_requests.any?
end
def build_builds(user, status = 'success', trigger_request = nil)
def build_builds(user, trigger_request = nil, status = 'success')
return unless config_processor
config_processor.stages.any? do |stage|
build_builds_for_stage(stage, user, status, trigger_request).present?
......@@ -99,8 +99,7 @@ module Ci
end
def create_builds(user, trigger_request = nil)
build_builds(user, 'success', trigger_request)
save
build_builds(user, trigger_request) && save
end
def create_next_builds(build)
......
......@@ -258,6 +258,16 @@ describe Ci::Pipeline, models: true do
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
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