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
b2465182
Commit
b2465182
authored
Jun 01, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user to BuildDetailsEntity
Also add minor changed needed to pass review
parent
6c872396
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
9 deletions
+18
-9
app/serializers/build_details_entity.rb
app/serializers/build_details_entity.rb
+7
-3
app/serializers/build_entity.rb
app/serializers/build_entity.rb
+4
-2
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+2
-1
spec/serializers/build_details_entity_spec.rb
spec/serializers/build_details_entity_spec.rb
+2
-1
spec/serializers/build_entity_spec.rb
spec/serializers/build_entity_spec.rb
+3
-2
No files found.
app/serializers/build_details_entity.rb
View file @
b2465182
...
@@ -2,6 +2,8 @@ class BuildDetailsEntity < BuildEntity
...
@@ -2,6 +2,8 @@ class BuildDetailsEntity < BuildEntity
expose
:coverage
,
:erased_at
,
:duration
expose
:coverage
,
:erased_at
,
:duration
expose
:tag_list
,
as: :tags
expose
:tag_list
,
as: :tags
expose
:user
,
using:
UserEntity
expose
:erased_by
,
if:
->
(
*
)
{
build
.
erased?
},
using:
UserEntity
expose
:erased_by
,
if:
->
(
*
)
{
build
.
erased?
},
using:
UserEntity
expose
:erase_path
,
if:
->
(
*
)
{
build
.
erasable?
&&
can?
(
current_user
,
:update_build
,
project
)
}
do
|
build
|
expose
:erase_path
,
if:
->
(
*
)
{
build
.
erasable?
&&
can?
(
current_user
,
:update_build
,
project
)
}
do
|
build
|
erase_namespace_project_job_path
(
project
.
namespace
,
project
,
build
)
erase_namespace_project_job_path
(
project
.
namespace
,
project
,
build
)
...
@@ -11,7 +13,7 @@ class BuildDetailsEntity < BuildEntity
...
@@ -11,7 +13,7 @@ class BuildDetailsEntity < BuildEntity
expose
:runner
,
using:
RunnerEntity
expose
:runner
,
using:
RunnerEntity
expose
:pipeline
,
using:
PipelineEntity
expose
:pipeline
,
using:
PipelineEntity
expose
:merge_request
,
if:
->
(
*
)
{
can?
(
current_user
,
:read_merge_request
,
projec
t
)
}
do
expose
:merge_request
,
if:
->
(
*
)
{
can?
(
current_user
,
:read_merge_request
,
build
.
merge_reques
t
)
}
do
expose
:iid
do
|
build
|
expose
:iid
do
|
build
|
build
.
merge_request
.
iid
build
.
merge_request
.
iid
end
end
...
@@ -21,9 +23,11 @@ class BuildDetailsEntity < BuildEntity
...
@@ -21,9 +23,11 @@ class BuildDetailsEntity < BuildEntity
end
end
end
end
expose
:build_failed_options
do
expose
:new_issue_path
,
if:
->
(
*
)
{
can?
(
request
.
current_user
,
:create_issue
,
project
)
}
do
|
build
|
expose
:new_issue_path
,
if:
->
(
*
)
{
can?
(
request
.
current_user
,
:create_issue
,
project
)
}
do
|
build
|
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
end
end
end
expose
:raw_path
do
|
build
|
expose
:raw_path
do
|
build
|
raw_namespace_project_build_path
(
project
.
namespace
,
project
,
build
)
raw_namespace_project_build_path
(
project
.
namespace
,
project
,
build
)
...
...
app/serializers/build_entity.rb
View file @
b2465182
...
@@ -8,9 +8,11 @@ class BuildEntity < Grape::Entity
...
@@ -8,9 +8,11 @@ class BuildEntity < Grape::Entity
path_to
(
:namespace_project_job
,
build
)
path_to
(
:namespace_project_job
,
build
)
end
end
expose
:build_failed_options
,
if:
->
(
*
)
{
build
.
retryable?
}
do
expose
:retry_path
do
|
build
|
expose
:retry_path
do
|
build
|
path_to
(
:retry_namespace_project_job
,
build
)
path_to
(
:retry_namespace_project_job
,
build
)
end
end
end
expose
:play_path
,
if:
->
(
*
)
{
playable?
}
do
|
build
|
expose
:play_path
,
if:
->
(
*
)
{
playable?
}
do
|
build
|
path_to
(
:play_namespace_project_job
,
build
)
path_to
(
:play_namespace_project_job
,
build
)
...
...
spec/controllers/projects/jobs_controller_spec.rb
View file @
b2465182
...
@@ -140,9 +140,10 @@ describe Projects::JobsController do
...
@@ -140,9 +140,10 @@ describe Projects::JobsController do
it
'exposes needed information'
do
it
'exposes needed information'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'new_issue_path'
]).
to
end_with
(
'/issues/new'
)
expect
(
json_response
[
'raw_path'
]).
to
match
(
/builds\/\d+\/raw\z/
)
expect
(
json_response
[
'raw_path'
]).
to
match
(
/builds\/\d+\/raw\z/
)
expect
(
json_response
.
dig
(
'merge_request'
,
'path'
)).
to
match
(
/merge_requests\/\d+\z/
)
expect
(
json_response
.
dig
(
'merge_request'
,
'path'
)).
to
match
(
/merge_requests\/\d+\z/
)
expect
(
json_response
[
'build_failed_options'
][
'new_issue_path'
])
.
to
end_with
(
'/issues/new'
)
end
end
end
end
...
...
spec/serializers/build_details_entity_spec.rb
View file @
b2465182
...
@@ -30,7 +30,8 @@ describe BuildDetailsEntity do
...
@@ -30,7 +30,8 @@ describe BuildDetailsEntity do
it
'contains the needed key value pairs'
do
it
'contains the needed key value pairs'
do
expect
(
subject
).
to
include
(
:coverage
,
:erased_at
,
:duration
)
expect
(
subject
).
to
include
(
:coverage
,
:erased_at
,
:duration
)
expect
(
subject
).
to
include
(
:artifacts
,
:runner
,
:pipeline
)
expect
(
subject
).
to
include
(
:artifacts
,
:runner
,
:pipeline
)
expect
(
subject
).
to
include
(
:raw_path
,
:merge_request
,
:new_issue_path
)
expect
(
subject
).
to
include
(
:raw_path
,
:merge_request
)
expect
(
subject
[
:build_failed_options
]).
to
include
(
:new_issue_path
)
end
end
it
'exposes details of the merge request'
do
it
'exposes details of the merge request'
do
...
...
spec/serializers/build_entity_spec.rb
View file @
b2465182
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
BuildEntity
do
describe
BuildEntity
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
,
:failed
)
}
let
(
:project
)
{
build
.
project
}
let
(
:project
)
{
build
.
project
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:request
)
{
double
(
'request'
)
}
...
@@ -17,7 +17,8 @@ describe BuildEntity do
...
@@ -17,7 +17,8 @@ describe BuildEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
it
'contains paths to build page and retry action'
do
it
'contains paths to build page and retry action'
do
expect
(
subject
).
to
include
(
:build_path
,
:retry_path
)
expect
(
subject
).
to
include
(
:build_path
,
:build_failed_options
)
expect
(
subject
.
dig
(
:build_failed_options
,
:retry_path
)).
not_to
be_nil
end
end
it
'does not contain sensitive information'
do
it
'does not contain sensitive information'
do
...
...
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