Commit c046b887 authored by Markus Koller's avatar Markus Koller

Merge branch 'jv-remove-unused-pages-code' into 'master'

Small improvements to UpdatePagesConfigurationService

See merge request gitlab-org/gitlab!37942
parents 25f61c67 6dc71d6f
......@@ -11,14 +11,14 @@ module Projects
end
def execute
if file_equals?(pages_config_file, pages_config_json)
return success(reload: false)
end
unless file_equals?(pages_config_file, pages_config_json)
update_file(pages_config_file, pages_config_json)
reload_daemon
success(reload: true)
end
success
rescue => e
Gitlab::ErrorTracking.track_exception(e)
error(e.message)
end
......
......@@ -14,12 +14,10 @@ class PagesWorker # rubocop:disable Scalability/IdempotentWorker
# rubocop: disable CodeReuse/ActiveRecord
def deploy(build_id)
build = Ci::Build.find_by(id: build_id)
result = Projects::UpdatePagesService.new(build.project, build).execute
if result[:status] == :success
result = Projects::UpdatePagesConfigurationService.new(build.project).execute
update_contents = Projects::UpdatePagesService.new(build.project, build).execute
if update_contents[:status] == :success
Projects::UpdatePagesConfigurationService.new(build.project).execute
end
result
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -24,7 +24,7 @@ RSpec.describe Projects::UpdatePagesConfigurationService do
it 'updates the .update file' do
expect(service).to receive(:reload_daemon).and_call_original
expect(subject).to include(status: :success, reload: true)
expect(subject).to include(status: :success)
end
end
......@@ -37,7 +37,7 @@ RSpec.describe Projects::UpdatePagesConfigurationService do
it 'does not update the .update file' do
expect(service).not_to receive(:reload_daemon)
expect(subject).to include(status: :success, reload: false)
expect(subject).to include(status: :success)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment