2015-11-03 20:28:07 +00:00
|
|
|
class PagesWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2015-11-03 20:28:07 +00:00
|
|
|
|
2018-03-05 12:57:48 +00:00
|
|
|
sidekiq_options retry: 3
|
2015-11-03 20:28:07 +00:00
|
|
|
|
2015-12-18 12:07:53 +00:00
|
|
|
def perform(action, *arg)
|
2017-08-04 02:20:34 +00:00
|
|
|
send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
|
2015-12-18 12:07:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def deploy(build_id)
|
2016-01-15 11:21:52 +00:00
|
|
|
build = Ci::Build.find_by(id: build_id)
|
2016-02-09 17:06:55 +00:00
|
|
|
result = Projects::UpdatePagesService.new(build.project, build).execute
|
|
|
|
if result[:status] == :success
|
|
|
|
result = Projects::UpdatePagesConfigurationService.new(build.project).execute
|
|
|
|
end
|
2018-01-11 16:34:01 +00:00
|
|
|
|
2016-02-09 17:06:55 +00:00
|
|
|
result
|
2015-12-16 15:29:53 +00:00
|
|
|
end
|
2015-11-03 20:28:07 +00:00
|
|
|
|
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
|
2015-11-03 20:28:07 +00:00
|
|
|
end
|