Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pages_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cceafbc7d2d5a863e4e5ae0d51f1622a37428d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

class PagesWorker # rubocop:disable Scalability/IdempotentWorker
  include ApplicationWorker

  data_consistency :always

  sidekiq_options retry: 3
  feature_category :pages
  loggable_arguments 0, 1
  worker_resource_boundary :cpu

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

  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

  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