Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/projects/builds/show.html.haml3
-rw-r--r--features/steps/project/builds/summary.rb4
-rw-r--r--lib/ci/api/builds.rb16
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