Class: Gitlab::Ci::Pipeline::Chain::Limit::ActiveJobs

Inherits:
Base
  • Object
show all
Includes:
Helpers, Utils::StrongMemoize
Defined in:
lib/gitlab/ci/pipeline/chain/limit/active_jobs.rb

Constant Summary collapse

LIMIT_NAME =
:ci_active_jobs
MESSAGE =
"Project exceeded the allowed number of jobs in active pipelines. Retry later."

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

Methods included from Helpers

#error, #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)


30
31
32
# File 'lib/gitlab/ci/pipeline/chain/limit/active_jobs.rb', line 30

def break?
  pipeline.errors.any?
end

#perform!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gitlab/ci/pipeline/chain/limit/active_jobs.rb', line 15

def perform!
  return unless limits.exceeded?(LIMIT_NAME, count_jobs_in_alive_pipelines)

  error(MESSAGE, drop_reason: :job_activity_limit_exceeded)

  Gitlab::AppLogger.info(
    class: self.class.name,
    message: MESSAGE,
    project_id: project.id,
    plan: project.actual_plan_name,
    project_path: project.path,
    jobs_in_alive_pipelines_count: count_jobs_in_alive_pipelines
  )
end