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
d3994058
Commit
d3994058
authored
Jan 14, 2021
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail pages deployment if it isn't latest
parent
17732266
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+3
-0
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+13
-0
No files found.
app/services/projects/update_pages_service.rb
View file @
d3994058
...
...
@@ -156,6 +156,9 @@ module Projects
deployment
=
project
.
pages_deployments
.
create!
(
file:
file
,
file_count:
entries_count
,
file_sha256:
sha256
)
raise
InvalidStateError
,
'build SHA is outdated for this ref'
unless
latest?
project
.
update_pages_deployment!
(
deployment
)
end
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
d3994058
...
...
@@ -79,6 +79,19 @@ RSpec.describe Projects::UpdatePagesService do
end
end
it
'fails if sha on branch was updated before deployment was uploaded'
do
expect
(
subject
).
to
receive
(
:create_pages_deployment
).
and_wrap_original
do
|
m
,
*
args
|
build
.
update!
(
ref:
'feature'
)
m
.
call
(
*
args
)
end
expect
(
execute
).
not_to
eq
(
:success
)
expect
(
project
.
pages_metadatum
).
not_to
be_deployed
expect
(
deploy_status
).
to
be_failed
expect
(
deploy_status
.
description
).
to
eq
(
'build SHA is outdated for this ref'
)
end
it
'does not fail if pages_metadata is absent'
do
project
.
pages_metadatum
.
destroy!
project
.
reload
...
...
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