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
a792ea39
Commit
a792ea39
authored
Dec 13, 2019
by
Erick Bajao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use has_expiring_archive_artifacts in BuildArtifactEntity
Move has_expiring_artifacts to be private.
parent
c92043c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
27 deletions
+7
-27
app/models/ci/build.rb
app/models/ci/build.rb
+4
-4
app/serializers/build_artifact_entity.rb
app/serializers/build_artifact_entity.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+0
-22
spec/serializers/build_artifact_entity_spec.rb
spec/serializers/build_artifact_entity_spec.rb
+2
-0
No files found.
app/models/ci/build.rb
View file @
a792ea39
...
...
@@ -717,10 +717,6 @@ module Ci
end
end
def
has_expiring_artifacts?
artifacts_expire_at
.
present?
&&
artifacts_expire_at
>
Time
.
now
end
def
has_expiring_archive_artifacts?
has_expiring_artifacts?
&&
artifacts_file
&
.
exists?
end
...
...
@@ -929,6 +925,10 @@ module Ci
value
.
with_indifferent_access
end
end
def
has_expiring_artifacts?
artifacts_expire_at
.
present?
&&
artifacts_expire_at
>
Time
.
now
end
end
end
...
...
app/serializers/build_artifact_entity.rb
View file @
a792ea39
...
...
@@ -14,7 +14,7 @@ class BuildArtifactEntity < Grape::Entity
download_project_job_artifacts_path
(
project
,
job
)
end
expose
:keep_path
,
if:
->
(
*
)
{
job
.
has_expiring_artifacts?
}
do
|
job
|
expose
:keep_path
,
if:
->
(
*
)
{
job
.
has_expiring_ar
chive_ar
tifacts?
}
do
|
job
|
keep_project_job_artifacts_path
(
project
,
job
)
end
...
...
spec/models/ci/build_spec.rb
View file @
a792ea39
...
...
@@ -2224,28 +2224,6 @@ describe Ci::Build do
end
end
describe
'#has_expiring_artifacts?'
do
context
'when artifacts have expiration date set'
do
before
do
build
.
update
(
artifacts_expire_at:
1
.
day
.
from_now
)
end
it
'has expiring artifacts'
do
expect
(
build
).
to
have_expiring_artifacts
end
end
context
'when artifacts do not have expiration date set'
do
before
do
build
.
update
(
artifacts_expire_at:
nil
)
end
it
'does not have expiring artifacts'
do
expect
(
build
).
not_to
have_expiring_artifacts
end
end
end
describe
'#has_expiring_archive_artifacts?'
do
context
'when artifacts have expiration date set'
do
before
do
...
...
spec/serializers/build_artifact_entity_spec.rb
View file @
a792ea39
...
...
@@ -4,6 +4,8 @@ require 'spec_helper'
describe
BuildArtifactEntity
do
let
(
:job
)
{
create
(
:ci_build
,
name:
'test:job'
,
artifacts_expire_at:
1
.
hour
.
from_now
)
}
let!
(
:archive
)
{
create
(
:ci_job_artifact
,
:archive
,
job:
job
)
}
let!
(
:metadata
)
{
create
(
:ci_job_artifact
,
:metadata
,
job:
job
)
}
let
(
:entity
)
do
described_class
.
new
(
job
,
request:
double
)
...
...
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