Class: Gitlab::Ci::Pipeline::Chain::CancelPendingPipelines

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/gitlab/ci/pipeline/chain/cancel_pending_pipelines.rb

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

Methods included from Helpers

#error, #persist_pipeline?, #warning

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Ci::Pipeline::Chain::Base

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)

20
21
22
# File 'lib/gitlab/ci/pipeline/chain/cancel_pending_pipelines.rb', line 20

def break?
  false
end

#perform!Object


10
11
12
13
14
15
16
17
18
# File 'lib/gitlab/ci/pipeline/chain/cancel_pending_pipelines.rb', line 10

def perform!
  return unless project.auto_cancel_pending_pipelines?

  Gitlab::OptimisticLocking.retry_lock(auto_cancelable_pipelines) do |cancelables|
    cancelables.find_each do |cancelable|
      cancelable.auto_cancel_running(pipeline)
    end
  end
end