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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
86800bf5
Commit
86800bf5
authored
Jun 10, 2016
by
Kamil Trzcinski
Committed by
Phil Hughes
Jun 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support expiration date in CI API when uploading artifacts
parent
1501940e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
lib/ci/api/builds.rb
lib/ci/api/builds.rb
+1
-1
lib/ci/api/entities.rb
lib/ci/api/entities.rb
+1
-0
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+36
-0
No files found.
lib/ci/api/builds.rb
View file @
86800bf5
...
...
@@ -146,7 +146,7 @@ module Ci
build
.
artifacts_file
=
artifacts
build
.
artifacts_metadata
=
metadata
build
.
artifacts_expire_
at
=
Time
.
now
+
ChronicDuration
.
parse
(
params
[
'expire_in'
])
build
.
artifacts_expire_
in
=
params
[
'expire_in'
]
if
build
.
save
present
(
build
,
with:
Entities
::
BuildDetails
)
...
...
lib/ci/api/entities.rb
View file @
86800bf5
...
...
@@ -29,6 +29,7 @@ module Ci
expose
:before_sha
expose
:allow_git_fetch
expose
:token
expose
:artifacts_expire_at
,
if:
lambda
{
|
build
,
opts
|
build
.
artifacts?
}
expose
:options
do
|
model
|
model
.
options
...
...
spec/requests/ci/api/builds_spec.rb
View file @
86800bf5
...
...
@@ -364,6 +364,42 @@ describe Ci::API::API do
end
end
context
'expire date'
do
let!
(
:artifacts
)
{
file_upload
}
let
(
:post_data
)
do
{
'file.path'
=>
artifacts
.
path
,
'file.name'
=>
artifacts
.
original_filename
,
'expire_in'
=>
expire_in
}
end
before
do
post
(
post_url
,
post_data
,
headers_with_token
)
end
context
'updates when specified'
do
let
(
:expire_in
)
{
'7 days'
}
it
do
build
.
reload
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'artifacts_expire_at'
]).
not_to
be_empty
expect
(
build
.
artifacts_expire_at
).
to
be_within
(
5
.
minutes
).
of
(
Time
.
now
+
7
.
days
)
end
end
context
'ignores if not specified'
do
let
(
:expire_in
)
{
nil
}
it
do
build
.
reload
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'artifacts_expire_at'
]).
to
be_nil
expect
(
build
.
artifacts_expire_at
).
to
be_nil
end
end
end
context
"artifacts file is too large"
do
it
"should fail to post too large artifact"
do
stub_application_setting
(
max_artifacts_size:
0
)
...
...
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