diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-15 15:03:43 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-15 15:12:25 +0300 |
commit | 2d495fce529cc3ac15f7096ddf9962db0fbd1e23 (patch) | |
tree | 66898d776423e166e2bc9ef1a287653e7c704d84 /app | |
parent | 69112072ca915e8d051f39bb8642f1c4fee4b692 (diff) |
Remove reduntant method for building pipeline builds
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 12 | ||||
-rw-r--r-- | app/services/ci/create_builds_service.rb | 3 | ||||
-rw-r--r-- | app/services/create_commit_builds_service.rb | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 58c69251824..a26cb7dd7ee 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -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) @@ -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 diff --git a/app/services/ci/create_builds_service.rb b/app/services/ci/create_builds_service.rb index f7f73aff989..b2882b23d31 100644 --- a/app/services/ci/create_builds_service.rb +++ b/app/services/ci/create_builds_service.rb @@ -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 diff --git a/app/services/create_commit_builds_service.rb b/app/services/create_commit_builds_service.rb index 668d0a86549..f947e8f452e 100644 --- a/app/services/create_commit_builds_service.rb +++ b/app/services/create_commit_builds_service.rb @@ -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 |