diff options
author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2016-02-02 17:39:47 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-19 19:24:59 +0300 |
commit | 6ca99bd899322ff4ada84f119907eb0210485482 (patch) | |
tree | dc52dc84c7f0ef11ef657f9c7cf326785a0ed800 | |
parent | c850ceec5d595d3808fa566db3d2e88faa3797cf (diff) |
And CI API endpoint where user can erase a build
-rw-r--r-- | app/views/projects/builds/show.html.haml | 3 | ||||
-rw-r--r-- | features/steps/project/builds/summary.rb | 4 | ||||
-rw-r--r-- | lib/ci/api/builds.rb | 16 |
3 files changed, 21 insertions, 2 deletions
diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index 32dd146b4b9..719709df1d5 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -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 diff --git a/features/steps/project/builds/summary.rb b/features/steps/project/builds/summary.rb index fd20a317850..4688a0e2096 100644 --- a/features/steps/project/builds/summary.rb +++ b/features/steps/project/builds/summary.rb @@ -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 diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index 416b0b5f0b4..23e909df366 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -159,6 +159,22 @@ module Ci 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 |