gitlab-org--gitlab-foss/app/workers/pages_worker.rb

30 lines
878 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class PagesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
2018-03-05 12:57:48 +00:00
sidekiq_options retry: 3
feature_category :pages
loggable_arguments 0, 1
tags :requires_disk_io
2015-12-18 12:07:53 +00:00
def perform(action, *arg)
send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
2015-12-18 12:07:53 +00:00
end
# rubocop: disable CodeReuse/ActiveRecord
2015-12-18 12:07:53 +00:00
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
2016-02-09 17:06:55 +00:00
end
2015-12-16 15:29:53 +00:00
end
# rubocop: enable CodeReuse/ActiveRecord
2015-12-18 12:07:53 +00:00
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
end