diff options
Diffstat (limited to 'app/models/ci/processable.rb')
-rw-r--r-- | app/models/ci/processable.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb index 7ad1a727a0e..414d36da7c3 100644 --- a/app/models/ci/processable.rb +++ b/app/models/ci/processable.rb @@ -9,6 +9,8 @@ module Ci include Ci::Metadatable extend ::Gitlab::Utils::Override + self.allow_legacy_sti_class = true + has_one :resource, class_name: 'Ci::Resource', foreign_key: 'build_id', inverse_of: :processable has_one :sourced_pipeline, class_name: 'Ci::Sources::Pipeline', foreign_key: :source_job_id, inverse_of: :source_job @@ -31,6 +33,12 @@ module Ci where('NOT EXISTS (?)', needs) end + scope :not_interruptible, -> do + joins(:metadata).where.not( + Ci::BuildMetadata.table_name => { id: Ci::BuildMetadata.scoped_build.with_interruptible.select(:id) } + ) + end + state_machine :status do event :enqueue do transition [:created, :skipped, :manual, :scheduled] => :waiting_for_resource, if: :with_resource_group? |