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
21152d7d
Commit
21152d7d
authored
Feb 03, 2016
by
Grzegorz Bizon
Committed by
Grzegorz Bizon
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use DELETE verb for erasing a build content
Also added API specs for that
parent
6ca99bd8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
11 deletions
+29
-11
app/views/projects/builds/show.html.haml
app/views/projects/builds/show.html.haml
+1
-1
config/routes.rb
config/routes.rb
+1
-1
lib/ci/api/builds.rb
lib/ci/api/builds.rb
+4
-2
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+5
-6
spec/models/build_spec.rb
spec/models/build_spec.rb
+0
-1
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+18
-0
No files found.
app/views/projects/builds/show.html.haml
View file @
21152d7d
...
...
@@ -120,7 +120,7 @@
=
link_to
"Retry"
,
@build
.
retry_url
,
class:
'btn btn-sm btn-primary'
,
method: :post
-
if
@build
.
eraseable?
=
link_to
@build
.
erase_url
,
class:
'btn btn-sm btn-warning'
,
method: :
put
,
=
link_to
@build
.
erase_url
,
class:
'btn btn-sm btn-warning'
,
method: :
delete
,
data:
{
confirm:
'Are you sure you want to erase this build?'
}
do
=
icon
(
'eraser'
)
Erase
...
...
config/routes.rb
View file @
21152d7d
...
...
@@ -617,7 +617,7 @@ Rails.application.routes.draw do
get
:status
post
:cancel
post
:retry
put
:erase
delete
:erase
end
resource
:artifacts
,
only:
[]
do
...
...
lib/ci/api/builds.rb
View file @
21152d7d
...
...
@@ -156,6 +156,7 @@ module Ci
build
=
Ci
::
Build
.
find_by_id
(
params
[
:id
])
not_found!
unless
build
authenticate_build_token!
(
build
)
build
.
remove_artifacts_file!
build
.
remove_artifacts_metadata!
end
...
...
@@ -168,11 +169,12 @@ module Ci
# Headers:
# BUILD-TOKEN (required) - The build authorization token, the same as token
# Example Request:
#
PUT /builds/:id/erase
put
':id/erase
'
do
#
DELETE /builds/:id/content
delete
':id/content
'
do
build
=
Ci
::
Build
.
find_by_id
(
params
[
:id
])
not_found!
unless
build
authenticate_build_token!
(
build
)
build
.
erase!
end
end
...
...
spec/factories/ci/builds.rb
View file @
21152d7d
...
...
@@ -62,14 +62,13 @@ FactoryGirl.define do
trait
:artifacts
do
after
(
:create
)
do
|
build
,
_
|
build
.
artifacts_file
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/ci_build_artifacts.zip'
,
'application/zip'
)
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts.zip'
),
'application/zip'
)
build
.
artifacts_metadata
=
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/ci_build_artifacts_metadata.gz'
,
'application/x-gzip'
)
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts_metadata.gz'
),
' application/x-gzip'
)
build
.
save!
end
end
...
...
spec/models/build_spec.rb
View file @
21152d7d
...
...
@@ -497,6 +497,5 @@ describe Ci::Build, models: true do
expect
(
@build2
.
merge_request
.
id
).
to
eq
(
@merge_request
.
id
)
end
end
end
end
spec/requests/ci/api/builds_spec.rb
View file @
21152d7d
...
...
@@ -148,6 +148,24 @@ describe Ci::API::API do
end
end
describe
'DELETE /builds/:id/content'
do
before
{
delete
ci_api
(
"/builds/
#{
build
.
id
}
/content"
),
token:
build
.
token
}
let!
(
:build
)
{
create
(
:ci_build_with_trace
,
:artifacts
,
:success
)
}
it
'should respond with valid status'
do
expect
(
response
.
status
).
to
eq
200
end
it
'should remove build artifacts'
do
expect
(
build
.
artifacts_file
.
exists?
).
to
be_falsy
expect
(
build
.
artifacts_metadata
.
exists?
).
to
be_falsy
end
it
'should remove build trace'
do
expect
(
build
.
trace
).
to
be_empty
end
end
context
"Artifacts"
do
let
(
:file_upload
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:file_upload2
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
,
'image/gif'
)
}
...
...
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