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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ad113a3c
Commit
ad113a3c
authored
Apr 27, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't automatically remove artifacts for pages jobs after pages:deploy has run
parent
4de3bc5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
51 deletions
+17
-51
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+2
-9
changelogs/unreleased/45481-sane-pages-artifacts.yml
changelogs/unreleased/45481-sane-pages-artifacts.yml
+6
-0
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+9
-42
No files found.
app/services/projects/update_pages_service.rb
View file @
ad113a3c
...
...
@@ -40,7 +40,7 @@ module Projects
rescue
InvaildStateError
=>
e
error
(
e
.
message
)
rescue
=>
e
error
(
e
.
message
,
false
)
error
(
e
.
message
)
raise
e
end
...
...
@@ -48,17 +48,15 @@ module Projects
def
success
@status
.
success
delete_artifact!
super
end
def
error
(
message
,
allow_delete_artifact
=
true
)
def
error
(
message
)
register_failure
log_error
(
"Projects::UpdatePagesService:
#{
message
}
"
)
@status
.
allow_failure
=
!
latest?
@status
.
description
=
message
@status
.
drop
(
:script_failure
)
delete_artifact!
if
allow_delete_artifact
super
end
...
...
@@ -162,11 +160,6 @@ module Projects
build
.
artifacts_file
.
path
end
def
delete_artifact!
build
.
reload
# Reload stable object to prevent erase artifacts with old state
build
.
erase_artifacts!
unless
build
.
has_expiring_artifacts?
end
def
latest_sha
project
.
commit
(
build
.
ref
).
try
(
:sha
).
to_s
ensure
...
...
changelogs/unreleased/45481-sane-pages-artifacts.yml
0 → 100644
View file @
ad113a3c
---
title
:
Don't automatically remove artifacts for pages jobs after pages:deploy has
run
merge_request
:
18628
author
:
type
:
fixed
spec/services/projects/update_pages_service_spec.rb
View file @
ad113a3c
...
...
@@ -29,25 +29,10 @@ describe Projects::UpdatePagesService do
end
describe
'pages artifacts'
do
context
'with expiry date'
do
before
do
build
.
artifacts_expire_in
=
"2 days"
build
.
save!
end
it
"doesn't delete artifacts"
do
expect
(
execute
).
to
eq
(
:success
)
expect
(
build
.
reload
.
artifacts?
).
to
eq
(
true
)
end
end
context
'without expiry date'
do
it
"does delete artifacts"
do
expect
(
execute
).
to
eq
(
:success
)
it
"doesn't delete artifacts after deploying"
do
expect
(
execute
).
to
eq
(
:success
)
expect
(
build
.
reload
.
artifacts?
).
to
eq
(
false
)
end
expect
(
build
.
reload
.
artifacts?
).
to
eq
(
true
)
end
end
...
...
@@ -100,25 +85,10 @@ describe Projects::UpdatePagesService do
end
describe
'pages artifacts'
do
context
'with expiry date'
do
before
do
build
.
artifacts_expire_in
=
"2 days"
build
.
save!
end
it
"doesn't delete artifacts"
do
expect
(
execute
).
to
eq
(
:success
)
expect
(
build
.
artifacts?
).
to
eq
(
true
)
end
end
context
'without expiry date'
do
it
"does delete artifacts"
do
expect
(
execute
).
to
eq
(
:success
)
it
"doesn't delete artifacts after deploying"
do
expect
(
execute
).
to
eq
(
:success
)
expect
(
build
.
reload
.
artifacts?
).
to
eq
(
false
)
end
expect
(
build
.
artifacts?
).
to
eq
(
true
)
end
end
...
...
@@ -171,13 +141,12 @@ describe Projects::UpdatePagesService do
build
.
reload
expect
(
deploy_status
).
to
be_failed
expect
(
build
.
artifacts?
).
to
be_truthy
end
end
context
'when failed to extract zip artifacts'
do
before
do
allow
_any_instance_of
(
described_class
)
expect
_any_instance_of
(
described_class
)
.
to
receive
(
:extract_zip_archive!
)
.
and_raise
(
Projects
::
UpdatePagesService
::
FailedToExtractError
)
end
...
...
@@ -188,21 +157,19 @@ describe Projects::UpdatePagesService do
build
.
reload
expect
(
deploy_status
).
to
be_failed
expect
(
build
.
artifacts?
).
to
be_truthy
end
end
context
'when missing artifacts metadata'
do
before
do
allow
(
build
).
to
receive
(
:artifacts_metadata?
).
and_return
(
false
)
expect
(
build
).
to
receive
(
:artifacts_metadata?
).
and_return
(
false
)
end
it
'does not raise an error a
nd remove artifacts a
s failed job'
do
it
'does not raise an error as failed job'
do
execute
build
.
reload
expect
(
deploy_status
).
to
be_failed
expect
(
build
.
artifacts?
).
to
be_falsey
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