Class: PagesWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker
Defined in:
app/workers/pages_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY

Constants included from WorkerAttributes

WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#deploy(build_id) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


16
17
18
19
20
21
22
# File 'app/workers/pages_worker.rb', line 16

def deploy(build_id)
  build = Ci::Build.find_by(id: build_id)
  update_contents = Projects::UpdatePagesService.new(build.project, build).execute
  if update_contents[:status] == :success
    Projects::UpdatePagesConfigurationService.new(build.project).execute
  end
end

#perform(action, *arg) ⇒ Object


11
12
13
# File 'app/workers/pages_worker.rb', line 11

def perform(action, *arg)
  send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
end

#remove(namespace_path, project_path) ⇒ Object

rubocop: enable CodeReuse/ActiveRecord


25
26
27
28
# File 'app/workers/pages_worker.rb', line 25

def remove(namespace_path, project_path)
  full_path = File.join(Settings.pages.path, namespace_path, project_path)
  FileUtils.rm_r(full_path, force: true)
end