diff options
author | Sean McGivern <sean@gitlab.com> | 2019-08-05 12:29:45 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-08-05 12:29:45 +0300 |
commit | d126df55fde21d2dc8eb9d5f72841a9792bca105 (patch) | |
tree | 0fa922bf6061df566b99141933c3774b85be27a9 /app/services | |
parent | fccbe0f97a76ba85daf745b4dd98375a5cd8f03f (diff) | |
parent | 593490e5ac6ec5a92fdcc9b82eebbb455ea6cf48 (diff) |
Merge branch 'prefer-to-use-process-pipeline-worker' into 'master'
Extend PipelineProcessWorker to accept a list of builds
See merge request gitlab-org/gitlab-ce!31425
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/ci/process_pipeline_service.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index a6d87101163..99d4ff9ecd1 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -4,7 +4,7 @@ module Ci class ProcessPipelineService < BaseService attr_reader :pipeline - def execute(pipeline, trigger_build_name = nil) + def execute(pipeline, trigger_build_ids = nil) @pipeline = pipeline update_retried @@ -13,7 +13,7 @@ module Ci # we evaluate dependent needs, # only when the another job has finished - success = process_builds_with_needs(trigger_build_name) || success + success = process_builds_with_needs(trigger_build_ids) || success @pipeline.update_status @@ -38,12 +38,18 @@ module Ci end end - def process_builds_with_needs(trigger_build_name) - return false unless trigger_build_name + def process_builds_with_needs(trigger_build_ids) + return false unless trigger_build_ids.present? return false unless Feature.enabled?(:ci_dag_support, project) + # rubocop: disable CodeReuse/ActiveRecord + trigger_build_names = pipeline.statuses + .where(id: trigger_build_ids) + .select(:name) + # rubocop: enable CodeReuse/ActiveRecord + created_processables - .with_needs(trigger_build_name) + .with_needs(trigger_build_names) .find_each .map(&method(:process_build_with_needs)) .any? |