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
4bbc14e6
Commit
4bbc14e6
authored
May 25, 2020
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'mc/feature/expose-artifacts-locked' into 'master'"
This reverts merge request !32787
parent
01cf3789
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
58 deletions
+13
-58
app/models/ci/build.rb
app/models/ci/build.rb
+0
-8
app/serializers/build_artifact_entity.rb
app/serializers/build_artifact_entity.rb
+0
-4
app/serializers/build_details_entity.rb
app/serializers/build_details_entity.rb
+0
-4
spec/fixtures/api/schemas/job/artifact.json
spec/fixtures/api/schemas/job/artifact.json
+1
-2
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+11
-35
spec/serializers/build_artifact_entity_spec.rb
spec/serializers/build_artifact_entity_spec.rb
+0
-4
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+1
-1
No files found.
app/models/ci/build.rb
View file @
4bbc14e6
...
...
@@ -777,8 +777,6 @@ module Ci
end
def
artifacts_expired?
return
false
if
artifacts_locked?
artifacts_expire_at
&&
artifacts_expire_at
<
Time
.
current
end
...
...
@@ -960,10 +958,6 @@ module Ci
private
def
artifacts_locked?
job_artifacts_archive
&
.
locked?
end
def
dependencies
strong_memoize
(
:dependencies
)
do
Ci
::
BuildDependencies
.
new
(
self
)
...
...
@@ -1033,8 +1027,6 @@ module Ci
end
def
has_expiring_artifacts?
return
false
if
artifacts_locked?
artifacts_expire_at
.
present?
&&
artifacts_expire_at
>
Time
.
current
end
...
...
app/serializers/build_artifact_entity.rb
View file @
4bbc14e6
...
...
@@ -23,10 +23,6 @@ class BuildArtifactEntity < Grape::Entity
fast_browse_project_job_artifacts_path
(
project
,
job
)
end
expose
:locked
,
if:
->
(
*
)
{
job
.
job_artifacts_archive
.
present?
}
do
|
job
|
job
.
job_artifacts_archive
.
locked?
end
private
alias_method
:job
,
:object
...
...
app/serializers/build_details_entity.rb
View file @
4bbc14e6
...
...
@@ -46,10 +46,6 @@ class BuildDetailsEntity < JobEntity
expose
:expired
,
if:
->
(
*
)
{
build
.
artifacts_expire_at
.
present?
}
do
|
build
|
build
.
artifacts_expired?
end
expose
:locked
,
if:
->
(
*
)
{
build
.
job_artifacts_archive
.
present?
}
do
|
build
|
build
.
job_artifacts_archive
.
locked?
end
end
expose
:report_artifacts
,
...
...
spec/fixtures/api/schemas/job/artifact.json
View file @
4bbc14e6
...
...
@@ -5,8 +5,7 @@
"browse_path"
:
{
"type"
:
"string"
},
"keep_path"
:
{
"type"
:
"string"
},
"expired"
:
{
"type"
:
"boolean"
},
"expire_at"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
},
"locked"
:
{
"type"
:
"boolean"
}
"expire_at"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
}
},
"additionalProperties"
:
false
}
spec/models/ci/build_spec.rb
View file @
4bbc14e6
...
...
@@ -590,28 +590,22 @@ describe Ci::Build do
describe
'#artifacts?'
do
subject
{
build
.
artifacts?
}
context
'artifacts archive does not exist'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
{
is_expected
.
to
be_falsy
}
end
context
'when new artifacts are used'
do
context
'artifacts archive does not exist'
do
let
(
:build
)
{
create
(
:ci_build
)
}
context
'artifacts archive exists'
do
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
)
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_falsy
}
end
context
'
is expired
'
do
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
:expired
)
}
context
'
artifacts archive exists
'
do
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
)
}
it
{
is_expected
.
to
be_
fals
y
}
it
{
is_expected
.
to
be_
truth
y
}
context
'is locked'
do
before
do
build
.
job_artifacts_archive
.
update
(
locked:
true
)
end
context
'is expired'
do
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
:expired
)
}
it
{
is_expected
.
to
be_
truth
y
}
it
{
is_expected
.
to
be_
fals
y
}
end
end
end
...
...
@@ -636,14 +630,6 @@ describe Ci::Build do
end
it
{
is_expected
.
to
be_truthy
}
context
'is locked'
do
before
do
create
(
:ci_job_artifact
,
:archive
,
job:
build
,
locked:
true
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
context
'is not expired'
do
...
...
@@ -2266,16 +2252,6 @@ describe Ci::Build do
it
'has expiring artifacts'
do
expect
(
build
).
to
have_expiring_archive_artifacts
end
context
'and job artifacts are locked'
do
before
do
archive
.
update
(
locked:
true
)
end
it
'does not have expiring artifacts'
do
expect
(
build
).
not_to
have_expiring_archive_artifacts
end
end
end
context
'and job artifacts archive record does not exist'
do
...
...
spec/serializers/build_artifact_entity_spec.rb
View file @
4bbc14e6
...
...
@@ -30,9 +30,5 @@ describe BuildArtifactEntity do
expect
(
subject
[
:browse_path
])
.
to
include
"jobs/
#{
job
.
id
}
/artifacts/browse"
end
it
'exposes locked information about artifact'
do
expect
(
subject
).
to
include
(
:locked
)
end
end
end
spec/serializers/build_details_entity_spec.rb
View file @
4bbc14e6
...
...
@@ -190,7 +190,7 @@ describe BuildDetailsEntity do
let!
(
:report
)
{
create
(
:ci_job_artifact
,
:codequality
,
job:
build
)
}
it
'exposes artifact details'
do
expect
(
subject
[
:artifact
].
keys
).
to
include
(
:download_path
,
:browse_path
,
:keep_path
,
:expire_at
,
:expired
,
:locked
)
expect
(
subject
[
:artifact
].
keys
).
to
include
(
:download_path
,
:browse_path
,
:keep_path
,
:expire_at
,
:expired
)
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