Class: Gitlab::Ci::Pipeline::Chain::Limit::Deployments

Inherits:
Base
  • Object
show all
Extended by:
Utils::Override
Includes:
Helpers
Defined in:
lib/gitlab/ci/pipeline/chain/limit/deployments.rb

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from Helpers

#error, #warning

Constructor Details

#initializeDeployments

Returns a new instance of Deployments.



15
16
17
18
19
20
# File 'lib/gitlab/ci/pipeline/chain/limit/deployments.rb', line 15

def initialize(*)
  super

  @limit = ::Gitlab::Ci::Pipeline::Quota::Deployments
    .new(project.namespace, pipeline, command)
end

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)


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

def break?
  limit.exceeded?
end

#perform!Object



23
24
25
26
27
28
# File 'lib/gitlab/ci/pipeline/chain/limit/deployments.rb', line 23

def perform!
  return unless limit.exceeded?

  limit.log_error!(project_id: project.id, plan: project.actual_plan_name)
  error(limit.message, drop_reason: :deployments_limit_exceeded)
end