Class: BuildHooksWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, PipelineQueue
Defined in:
app/workers/build_hooks_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Gitlab::Loggable

Gitlab::Loggable::ANONYMOUS

Constants included from WorkerAttributes

WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Loggable

#build_structured_payload

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Class Method Details

.perform_async(build) ⇒ Object

rubocop: enable CodeReuse/ActiveRecord



22
23
24
25
26
27
28
29
30
31
32
# File 'app/workers/build_hooks_worker.rb', line 22

def self.perform_async(build)
  Gitlab::AppLogger.info(
    message: "Enqueuing hooks for Build #{build.id}: #{build.status}",
    class: self.name,
    build_id: build.id,
    pipeline_id: build.pipeline_id,
    project_id: build.project_id,
    build_status: build.status)

  super(build.id)
end

Instance Method Details

#perform(build_id) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord



15
16
17
18
19
# File 'app/workers/build_hooks_worker.rb', line 15

def perform(build_id)
  build = Ci::Build.find_by_id(build_id)

  build.execute_hooks if build
end