Commit 6ca99bd8 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Grzegorz Bizon
Browse files

And CI API endpoint where user can erase a build

parent c850ceec
......@@ -83,7 +83,8 @@
= raw @build.trace_html
- else
.erased.alert.alert-warning
Build has been erased by #{@build.erased_by.username} #{time_ago_with_tooltip(@build.created_at)}
- erased_by = "by #{@build.erased_by.username}" if @build.erased_by
Build has been erased #{erased_by} #{time_ago_with_tooltip(@build.created_at)}
%div#down-build-trace
......
......@@ -26,6 +26,8 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps
end
step 'recent build summary contains information saying that build has been erased' do
expect(page).to have_css('.erased')
page.within('.erased') do
expect(page).to have_content 'Build has been erased'
end
end
end
......@@ -159,6 +159,22 @@ class Builds < Grape::API
build.remove_artifacts_file!
build.remove_artifacts_metadata!
end
# Erase build (remove artifacts and build trace)
#
# Parameters:
# id (required) - The ID of a build
# token (required) - The build authorization token
# Headers:
# BUILD-TOKEN (required) - The build authorization token, the same as token
# Example Request:
# PUT /builds/:id/erase
put ':id/erase' do
build = Ci::Build.find_by_id(params[:id])
not_found! unless build
authenticate_build_token!(build)
build.erase!
end
end
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment