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
Jérome Perrin
gitlab-ce
Commits
08bc2f94
Commit
08bc2f94
authored
Aug 13, 2017
by
Mehdi Lahmam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose `duration` in Job API entity
Closes #35794.
parent
1d5f2f9c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
changelogs/unreleased/expose-job-duration.yml
changelogs/unreleased/expose-job-duration.yml
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+11
-1
No files found.
changelogs/unreleased/expose-job-duration.yml
0 → 100644
View file @
08bc2f94
---
title
:
Expose duration in Job entity
merge_request
:
13644
author
:
Mehdi Lahmam (@mehlah)
type
:
added
lib/api/entities.rb
View file @
08bc2f94
...
...
@@ -822,6 +822,7 @@ module API
class
Job
<
Grape
::
Entity
expose
:id
,
:status
,
:stage
,
:name
,
:ref
,
:tag
,
:coverage
expose
:created_at
,
:started_at
,
:finished_at
expose
:duration
expose
:user
,
with:
User
expose
:artifacts_file
,
using:
JobArtifactFile
,
if:
->
(
job
,
opts
)
{
job
.
artifacts?
}
expose
:commit
,
with:
Commit
...
...
spec/requests/api/jobs_spec.rb
View file @
08bc2f94
...
...
@@ -165,7 +165,17 @@ describe API::Jobs do
context
'authorized user'
do
it
'returns specific job data'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'name'
]).
to
eq
(
'test'
)
expect
(
json_response
[
'id'
]).
to
eq
(
job
.
id
)
expect
(
json_response
[
'status'
]).
to
eq
(
job
.
status
)
expect
(
json_response
[
'stage'
]).
to
eq
(
job
.
stage
)
expect
(
json_response
[
'name'
]).
to
eq
(
job
.
name
)
expect
(
json_response
[
'ref'
]).
to
eq
(
job
.
ref
)
expect
(
json_response
[
'tag'
]).
to
eq
(
job
.
tag
)
expect
(
json_response
[
'coverage'
]).
to
eq
(
job
.
coverage
)
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
job
.
created_at
)
expect
(
Time
.
parse
(
json_response
[
'started_at'
])).
to
be_like_time
(
job
.
started_at
)
expect
(
Time
.
parse
(
json_response
[
'finished_at'
])).
to
be_like_time
(
job
.
finished_at
)
expect
(
json_response
[
'duration'
]).
to
eq
(
job
.
duration
)
end
it
'returns pipeline data'
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