diff options
Diffstat (limited to 'app/models/ci/processable.rb')
-rw-r--r-- | app/models/ci/processable.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb index 9c56aa67e20..6c4b271cd2c 100644 --- a/app/models/ci/processable.rb +++ b/app/models/ci/processable.rb @@ -8,8 +8,26 @@ module Ci scope :preload_needs, -> { preload(:needs) } + def self.select_with_aggregated_needs(project) + return all unless Feature.enabled?(:ci_dag_support, project, default_enabled: true) + + aggregated_needs_names = Ci::BuildNeed + .scoped_build + .select("ARRAY_AGG(name)") + .to_sql + + all.select( + '*', + "(#{aggregated_needs_names}) as aggregated_needs_names" + ) + end + validates :type, presence: true + def aggregated_needs_names + read_attribute(:aggregated_needs_names) + end + def schedulable? raise NotImplementedError end |