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
Boxiang Sun
gitlab-ce
Commits
4131a49b
Commit
4131a49b
authored
May 10, 2018
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose artifacts_expire_at field for job entity in api
https://gitlab.com/gitlab-org/gitlab-ce/issues/45798
parent
de12348e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
changelogs/unreleased/add-artifacts_expire_at-to-api.yml
changelogs/unreleased/add-artifacts_expire_at-to-api.yml
+5
-0
doc/api/jobs.md
doc/api/jobs.md
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+7
-1
No files found.
changelogs/unreleased/add-artifacts_expire_at-to-api.yml
0 → 100644
View file @
4131a49b
---
title
:
Expose artifacts_expire_at field for job entity in api
merge_request
:
18872
author
:
Semyon Pupkov
type
:
added
doc/api/jobs.md
View file @
4131a49b
...
@@ -38,6 +38,7 @@ Example of response
...
@@ -38,6 +38,7 @@ Example of response
"size"
:
1000
"size"
:
1000
},
},
"finished_at"
:
"2015-12-24T17:54:27.895Z"
,
"finished_at"
:
"2015-12-24T17:54:27.895Z"
,
"artifacts_expire_at"
:
"2016-01-23T17:54:27.895Z"
"id"
:
7
,
"id"
:
7
,
"name"
:
"teaspoon"
,
"name"
:
"teaspoon"
,
"pipeline"
:
{
"pipeline"
:
{
...
@@ -81,6 +82,7 @@ Example of response
...
@@ -81,6 +82,7 @@ Example of response
"created_at"
:
"2015-12-24T15:51:21.727Z"
,
"created_at"
:
"2015-12-24T15:51:21.727Z"
,
"artifacts_file"
:
null
,
"artifacts_file"
:
null
,
"finished_at"
:
"2015-12-24T17:54:24.921Z"
,
"finished_at"
:
"2015-12-24T17:54:24.921Z"
,
"artifacts_expire_at"
:
"2016-01-23T17:54:24.921Z"
,
"id"
:
6
,
"id"
:
6
,
"name"
:
"rspec:other"
,
"name"
:
"rspec:other"
,
"pipeline"
:
{
"pipeline"
:
{
...
@@ -152,6 +154,7 @@ Example of response
...
@@ -152,6 +154,7 @@ Example of response
"size"
:
1000
"size"
:
1000
},
},
"finished_at"
:
"2015-12-24T17:54:27.895Z"
,
"finished_at"
:
"2015-12-24T17:54:27.895Z"
,
"artifacts_expire_at"
:
"2016-01-23T17:54:27.895Z"
"id"
:
7
,
"id"
:
7
,
"name"
:
"teaspoon"
,
"name"
:
"teaspoon"
,
"pipeline"
:
{
"pipeline"
:
{
...
@@ -195,6 +198,7 @@ Example of response
...
@@ -195,6 +198,7 @@ Example of response
"created_at"
:
"2015-12-24T15:51:21.727Z"
,
"created_at"
:
"2015-12-24T15:51:21.727Z"
,
"artifacts_file"
:
null
,
"artifacts_file"
:
null
,
"finished_at"
:
"2015-12-24T17:54:24.921Z"
,
"finished_at"
:
"2015-12-24T17:54:24.921Z"
,
"artifacts_expire_at"
:
"2016-01-23T17:54:24.921Z"
"id"
:
6
,
"id"
:
6
,
"name"
:
"rspec:other"
,
"name"
:
"rspec:other"
,
"pipeline"
:
{
"pipeline"
:
{
...
@@ -261,6 +265,7 @@ Example of response
...
@@ -261,6 +265,7 @@ Example of response
"created_at"
:
"2015-12-24T15:51:21.880Z"
,
"created_at"
:
"2015-12-24T15:51:21.880Z"
,
"artifacts_file"
:
null
,
"artifacts_file"
:
null
,
"finished_at"
:
"2015-12-24T17:54:31.198Z"
,
"finished_at"
:
"2015-12-24T17:54:31.198Z"
,
"artifacts_expire_at"
:
"2016-01-23T17:54:31.198Z"
,
"id"
:
8
,
"id"
:
8
,
"name"
:
"rubocop"
,
"name"
:
"rubocop"
,
"pipeline"
:
{
"pipeline"
:
{
...
...
lib/api/entities.rb
View file @
4131a49b
...
@@ -1020,6 +1020,7 @@ module API
...
@@ -1020,6 +1020,7 @@ module API
class
Job
<
JobBasic
class
Job
<
JobBasic
expose
:artifacts_file
,
using:
JobArtifactFile
,
if:
->
(
job
,
opts
)
{
job
.
artifacts?
}
expose
:artifacts_file
,
using:
JobArtifactFile
,
if:
->
(
job
,
opts
)
{
job
.
artifacts?
}
expose
:runner
,
with:
Runner
expose
:runner
,
with:
Runner
expose
:artifacts_expire_at
end
end
class
JobBasicWithProject
<
JobBasic
class
JobBasicWithProject
<
JobBasic
...
...
spec/requests/api/jobs_spec.rb
View file @
4131a49b
...
@@ -13,7 +13,10 @@ describe API::Jobs do
...
@@ -13,7 +13,10 @@ describe API::Jobs do
ref:
project
.
default_branch
)
ref:
project
.
default_branch
)
end
end
let!
(
:job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
)
}
let!
(
:job
)
do
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
artifacts_expire_at:
1
.
day
.
since
)
end
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:api_user
)
{
user
}
let
(
:api_user
)
{
user
}
...
@@ -43,6 +46,7 @@ describe API::Jobs do
...
@@ -43,6 +46,7 @@ describe API::Jobs do
it
'returns correct values'
do
it
'returns correct values'
do
expect
(
json_response
).
not_to
be_empty
expect
(
json_response
).
not_to
be_empty
expect
(
json_response
.
first
[
'commit'
][
'id'
]).
to
eq
project
.
commit
.
id
expect
(
json_response
.
first
[
'commit'
][
'id'
]).
to
eq
project
.
commit
.
id
expect
(
Time
.
parse
(
json_response
.
first
[
'artifacts_expire_at'
])).
to
be_like_time
(
job
.
artifacts_expire_at
)
end
end
it
'returns pipeline data'
do
it
'returns pipeline data'
do
...
@@ -128,6 +132,7 @@ describe API::Jobs do
...
@@ -128,6 +132,7 @@ describe API::Jobs do
it
'returns correct values'
do
it
'returns correct values'
do
expect
(
json_response
).
not_to
be_empty
expect
(
json_response
).
not_to
be_empty
expect
(
json_response
.
first
[
'commit'
][
'id'
]).
to
eq
project
.
commit
.
id
expect
(
json_response
.
first
[
'commit'
][
'id'
]).
to
eq
project
.
commit
.
id
expect
(
Time
.
parse
(
json_response
.
first
[
'artifacts_expire_at'
])).
to
be_like_time
(
job
.
artifacts_expire_at
)
end
end
it
'returns pipeline data'
do
it
'returns pipeline data'
do
...
@@ -201,6 +206,7 @@ describe API::Jobs do
...
@@ -201,6 +206,7 @@ describe API::Jobs do
expect
(
Time
.
parse
(
json_response
[
'created_at'
])).
to
be_like_time
(
job
.
created_at
)
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
[
'started_at'
])).
to
be_like_time
(
job
.
started_at
)
expect
(
Time
.
parse
(
json_response
[
'finished_at'
])).
to
be_like_time
(
job
.
finished_at
)
expect
(
Time
.
parse
(
json_response
[
'finished_at'
])).
to
be_like_time
(
job
.
finished_at
)
expect
(
Time
.
parse
(
json_response
[
'artifacts_expire_at'
])).
to
be_like_time
(
job
.
artifacts_expire_at
)
expect
(
json_response
[
'duration'
]).
to
eq
(
job
.
duration
)
expect
(
json_response
[
'duration'
]).
to
eq
(
job
.
duration
)
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