Class: Ci::CreateCommitStatusService

Inherits:
BaseService show all
Includes:
Gitlab::ExclusiveLeaseHelpers, Gitlab::Utils::StrongMemoize, Services::ReturnServiceResponses
Defined in:
app/services/ci/create_commit_status_service.rb

Constant Summary collapse

InvalidState =
Class.new(StandardError)
DEFAULT_LIMIT_PIPELINES =

Default number of pipelines to return

100

Constants included from Gitlab::ExclusiveLeaseHelpers

Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError

Constants inherited from BaseService

BaseService::UnauthorizedError

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Services::ReturnServiceResponses

#error, #success

Methods included from Gitlab::ExclusiveLeaseHelpers

#in_lock

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#execute(optional_commit_status_params:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'app/services/ci/create_commit_status_service.rb', line 16

def execute(optional_commit_status_params:)
  in_lock(pipeline_lock_key, **pipeline_lock_params) do
    @optional_commit_status_params = optional_commit_status_params
    unsafe_execute
  end
rescue FailedToObtainLockError
  ServiceResponse.error(
    message: 'Another update to this commit status is in progress',
    reason: :conflict
  )
end