BigW Consortium Gitlab

pages_worker.rb 643 Bytes
Newer Older
Kamil Trzcinski committed
1
class PagesWorker
2
  include ApplicationWorker
Kamil Trzcinski committed
3

4
  sidekiq_options 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
    result = Projects::UpdatePagesService.new(build.project, build).execute
    if result[:status] == :success
      result = Projects::UpdatePagesConfigurationService.new(build.project).execute
    end
16

17
    result
Kamil Trzcinski committed
18
  end
Kamil Trzcinski committed
19

20 21 22 23
  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
24
end