diff options
Diffstat (limited to 'app/services/ci/pipeline_processing')
-rw-r--r-- | app/services/ci/pipeline_processing/atomic_processing_service.rb | 2 | ||||
-rw-r--r-- | app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/app/services/ci/pipeline_processing/atomic_processing_service.rb b/app/services/ci/pipeline_processing/atomic_processing_service.rb index 2a1bf15b9a3..b01a9d2e3b8 100644 --- a/app/services/ci/pipeline_processing/atomic_processing_service.rb +++ b/app/services/ci/pipeline_processing/atomic_processing_service.rb @@ -95,7 +95,7 @@ module Ci def processable_status(processable) if processable.scheduling_type_dag? # Processable uses DAG, get status of all dependent needs - @collection.status_for_names(processable.aggregated_needs_names.to_a) + @collection.status_for_names(processable.aggregated_needs_names.to_a, dag: true) else # Processable uses Stages, get status of prior stage @collection.status_for_prior_stage_position(processable.stage_idx.to_i) diff --git a/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb b/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb index 42e38a5c80f..2228328882d 100644 --- a/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb +++ b/app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb @@ -32,14 +32,14 @@ module Ci # This methods gets composite status of all processables def status_of_all - status_for_array(all_statuses) + status_for_array(all_statuses, dag: false) end # This methods gets composite status for processables with given names - def status_for_names(names) + def status_for_names(names, dag:) name_statuses = all_statuses_by_name.slice(*names) - status_for_array(name_statuses.values) + status_for_array(name_statuses.values, dag: dag) end # This methods gets composite status for processables before given stage @@ -48,7 +48,7 @@ module Ci stage_statuses = all_statuses_grouped_by_stage_position .select { |stage_position, _| stage_position < position } - status_for_array(stage_statuses.values.flatten) + status_for_array(stage_statuses.values.flatten, dag: false) end end @@ -65,7 +65,7 @@ module Ci strong_memoize("status_for_stage_position_#{current_position}") do stage_statuses = all_statuses_grouped_by_stage_position[current_position].to_a - status_for_array(stage_statuses.flatten) + status_for_array(stage_statuses.flatten, dag: false) end end @@ -76,7 +76,14 @@ module Ci private - def status_for_array(statuses) + def status_for_array(statuses, dag:) + # TODO: This is hack to support + # the same exact behaviour for Atomic and Legacy processing + # that DAG is blocked from executing if dependent is not "complete" + if dag && statuses.any? { |status| HasStatus::COMPLETED_STATUSES.exclude?(status[:status]) } + return 'pending' + end + result = Gitlab::Ci::Status::Composite .new(statuses) .status |