Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6dc71d6f
Commit
6dc71d6f
authored
Jul 29, 2020
by
Jacob Vosmaer
Committed by
Markus Koller
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small improvements to UpdatePagesConfigurationService
parent
4504c75b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
app/services/projects/update_pages_configuration_service.rb
app/services/projects/update_pages_configuration_service.rb
+5
-5
app/workers/pages_worker.rb
app/workers/pages_worker.rb
+3
-5
spec/services/projects/update_pages_configuration_service_spec.rb
...vices/projects/update_pages_configuration_service_spec.rb
+2
-2
No files found.
app/services/projects/update_pages_configuration_service.rb
View file @
6dc71d6f
...
...
@@ -11,14 +11,14 @@ module Projects
end
def
execute
if
file_equals?
(
pages_config_file
,
pages_config_json
)
return
success
(
reload:
false
)
unless
file_equals?
(
pages_config_file
,
pages_config_json
)
update_file
(
pages_config_file
,
pages_config_json
)
reload_daemon
end
update_file
(
pages_config_file
,
pages_config_json
)
reload_daemon
success
(
reload:
true
)
success
rescue
=>
e
Gitlab
::
ErrorTracking
.
track_exception
(
e
)
error
(
e
.
message
)
end
...
...
app/workers/pages_worker.rb
View file @
6dc71d6f
...
...
@@ -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
...
...
spec/services/projects/update_pages_configuration_service_spec.rb
View file @
6dc71d6f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment