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
aef12ce5
Commit
aef12ce5
authored
Dec 23, 2019
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'eb-no-keep-report-artifacts' into 'master'"
This reverts merge request !21553
parent
19a339be
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
8 additions
and
51 deletions
+8
-51
app/models/ci/build.rb
app/models/ci/build.rb
+2
-6
app/serializers/build_artifact_entity.rb
app/serializers/build_artifact_entity.rb
+1
-1
app/serializers/build_details_entity.rb
app/serializers/build_details_entity.rb
+1
-1
changelogs/unreleased/eb-no-keep-report-artifacts.yml
changelogs/unreleased/eb-no-keep-report-artifacts.yml
+0
-5
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+4
-14
spec/serializers/build_artifact_entity_spec.rb
spec/serializers/build_artifact_entity_spec.rb
+0
-2
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+0
-22
No files found.
app/models/ci/build.rb
View file @
aef12ce5
...
...
@@ -719,8 +719,8 @@ module Ci
end
end
def
has_expiring_ar
chive_ar
tifacts?
has_expiring_artifacts?
&&
artifacts_file
&
.
exists?
def
has_expiring_artifacts?
artifacts_expire_at
.
present?
&&
artifacts_expire_at
>
Time
.
now
end
def
keep_artifacts!
...
...
@@ -935,10 +935,6 @@ 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 @
aef12ce5
...
...
@@ -14,7 +14,7 @@ class BuildArtifactEntity < Grape::Entity
download_project_job_artifacts_path
(
project
,
job
)
end
expose
:keep_path
,
if:
->
(
*
)
{
job
.
has_expiring_ar
chive_ar
tifacts?
}
do
|
job
|
expose
:keep_path
,
if:
->
(
*
)
{
job
.
has_expiring_artifacts?
}
do
|
job
|
keep_project_job_artifacts_path
(
project
,
job
)
end
...
...
app/serializers/build_details_entity.rb
View file @
aef12ce5
...
...
@@ -31,7 +31,7 @@ class BuildDetailsEntity < JobEntity
browse_project_job_artifacts_path
(
project
,
build
)
end
expose
:keep_path
,
if:
->
(
*
)
{
build
.
has_expiring_ar
chive_ar
tifacts?
&&
can?
(
current_user
,
:update_build
,
build
)
}
do
|
build
|
expose
:keep_path
,
if:
->
(
*
)
{
build
.
has_expiring_artifacts?
&&
can?
(
current_user
,
:update_build
,
build
)
}
do
|
build
|
keep_project_job_artifacts_path
(
project
,
build
)
end
...
...
changelogs/unreleased/eb-no-keep-report-artifacts.yml
deleted
100644 → 0
View file @
19a339be
---
title
:
Remove keep button for non archive artifacts
merge_request
:
21553
author
:
type
:
fixed
spec/models/ci/build_spec.rb
View file @
aef12ce5
...
...
@@ -2248,24 +2248,14 @@ describe Ci::Build do
end
end
describe
'#has_expiring_ar
chive_ar
tifacts?'
do
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
context
'and job artifacts file exists'
do
let!
(
:archive
)
{
create
(
:ci_job_artifact
,
:archive
,
job:
build
)
}
it
'has expiring artifacts'
do
expect
(
build
).
to
have_expiring_archive_artifacts
end
end
context
'and job artifacts file does not exist'
do
it
'does not have expiring artifacts'
do
expect
(
build
).
not_to
have_expiring_archive_artifacts
end
it
'has expiring artifacts'
do
expect
(
build
).
to
have_expiring_artifacts
end
end
...
...
@@ -2275,7 +2265,7 @@ describe Ci::Build do
end
it
'does not have expiring artifacts'
do
expect
(
build
).
not_to
have_expiring_ar
chive_ar
tifacts
expect
(
build
).
not_to
have_expiring_artifacts
end
end
end
...
...
spec/serializers/build_artifact_entity_spec.rb
View file @
aef12ce5
...
...
@@ -4,8 +4,6 @@ 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
)
...
...
spec/serializers/build_details_entity_spec.rb
View file @
aef12ce5
...
...
@@ -176,27 +176,5 @@ describe BuildDetailsEntity do
expect
(
subject
[
:reports
].
first
[
:file_type
]).
to
eq
(
'codequality'
)
end
end
context
'when the build has no archive type artifacts'
do
let!
(
:report
)
{
create
(
:ci_job_artifact
,
:codequality
,
job:
build
)
}
it
'does not expose any artifact actions path'
do
expect
(
subject
[
:artifact
].
keys
).
not_to
include
(
:download_path
,
:browse_path
,
:keep_path
)
end
end
context
'when the build has archive type artifacts'
do
let!
(
:report
)
{
create
(
:ci_job_artifact
,
:codequality
,
job:
build
)
}
let!
(
:archive
)
{
create
(
:ci_job_artifact
,
:archive
,
job:
build
)
}
let!
(
:metadata
)
{
create
(
:ci_job_artifact
,
:metadata
,
job:
build
)
}
before
do
build
.
update
(
artifacts_expire_at:
7
.
days
.
from_now
)
end
it
'exposes artifact details'
do
expect
(
subject
[
:artifact
].
keys
).
to
include
(
:download_path
,
:browse_path
,
:keep_path
,
:expire_at
,
:expired
)
end
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