BigW Consortium Gitlab

pages_worker.rb 655 Bytes
Newer Older
Kamil Trzcinski committed
1 2 3
class PagesWorker
  include Sidekiq::Worker

4
  sidekiq_options queue: :pages, retry: false
Kamil Trzcinski committed
5

6
  def perform(action, *arg)
7
    send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
8 9 10
  end

  def deploy(build_id)
11
    build = Ci::Build.find_by(id: build_id)
12 13 14 15 16
    result = Projects::UpdatePagesService.new(build.project, build).execute
    if result[:status] == :success
      result = Projects::UpdatePagesConfigurationService.new(build.project).execute
    end
    result
Kamil Trzcinski committed
17
  end
Kamil Trzcinski committed
18

19 20 21 22
  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
Kamil Trzcinski committed
23
end