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
Léo-Paul Géneau
gitlab-ce
Commits
31bd09a3
Commit
31bd09a3
authored
May 01, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose report download path in build details
Exposes report download paths in build details.
parent
51183ad3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
+55
-0
app/serializers/build_details_entity.rb
app/serializers/build_details_entity.rb
+4
-0
app/serializers/job_artifact_entity.rb
app/serializers/job_artifact_entity.rb
+15
-0
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+8
-0
spec/serializers/job_artifact_entity_spec.rb
spec/serializers/job_artifact_entity_spec.rb
+28
-0
No files found.
app/serializers/build_details_entity.rb
View file @
31bd09a3
...
...
@@ -42,6 +42,10 @@ class BuildDetailsEntity < JobEntity
end
end
expose
:reports
,
if:
->
(
*
)
{
can?
(
current_user
,
:read_build
,
build
)
},
using:
JobArtifactEntity
do
|
build
|
build
.
job_artifacts
.
merge
(
Ci
::
JobArtifact
.
with_all_reports
)
end
expose
:erased_by
,
if:
->
(
*
)
{
build
.
erased?
},
using:
UserEntity
expose
:erase_path
,
if:
->
(
*
)
{
build
.
erasable?
&&
can?
(
current_user
,
:erase_build
,
build
)
}
do
|
build
|
erase_project_job_path
(
project
,
build
)
...
...
app/serializers/job_artifact_entity.rb
0 → 100644
View file @
31bd09a3
# frozen_string_literal: true
class
JobArtifactEntity
<
Grape
::
Entity
include
RequestAwareEntity
expose
:file_type
expose
:file_format
expose
:size
expose
:download_path
do
|
artifact
|
download_project_job_artifacts_path
(
job
.
project
,
job
,
file_type:
artifact
.
file_format
)
end
alias_method
:job
,
:object
end
spec/serializers/build_details_entity_spec.rb
View file @
31bd09a3
...
...
@@ -146,5 +146,13 @@ describe BuildDetailsEntity do
end
end
end
context
'when the build has reports'
do
let!
(
:report
)
{
create
(
:ci_job_artifact
,
:codequality
,
job:
build
)
}
it
'exposes the report artifacts'
do
expect
(
subject
[
:reports
]).
not_to
be_empty
end
end
end
end
spec/serializers/job_artifact_entity_spec.rb
0 → 100644
View file @
31bd09a3
# frozen_string_literal: true
require
'spec_helper'
describe
JobArtifactEntity
do
let
(
:report
)
{
create
(
:ci_job_artifact
,
:codequality
)
}
let
(
:entity
)
{
described_class
.
new
(
report
,
request:
double
)
}
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'exposes file_type'
do
expect
(
subject
[
:file_type
]).
to
eq
(
report
.
file_type
)
end
it
'exposes file_format'
do
expect
(
subject
[
:file_format
]).
to
eq
(
report
.
file_format
)
end
it
'exposes size'
do
expect
(
subject
[
:size
]).
to
eq
(
report
.
size
)
end
it
'exposes download path'
do
expect
(
subject
[
:download_path
]).
to
include
(
"jobs/
#{
report
.
job
.
id
}
/artifacts/download"
)
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