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:
authorDouwe Maan <douwe@gitlab.com>2015-10-17 16:50:39 +0300
committerDouwe Maan <douwe@gitlab.com>2015-10-17 18:53:08 +0300
commit5ff3c2dec9efe827d28d81f5b82aefbb37461b82 (patch)
treeb864006e9c713dcc900d13b45d8188e715acb6a4
parentb3d380ec7dca09af5fe21dfe89c14e77d65bf308 (diff)
Allow all failed commit builds to be retried.
-rw-r--r--app/controllers/projects/commit_controller.rb10
-rw-r--r--app/views/projects/commit/ci.html.haml3
-rw-r--r--config/routes.rb1
3 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb
index 885d3d03c19..5a3ed503899 100644
--- a/app/controllers/projects/commit_controller.rb
+++ b/app/controllers/projects/commit_controller.rb
@@ -39,6 +39,16 @@ class Projects::CommitController < Projects::ApplicationController
redirect_to ci_namespace_project_commit_path(project.namespace, project, commit.sha)
end
+ def retry_builds
+ @ci_commit = @project.ci_commit(@commit.sha)
+ @ci_commit.builds.latest.failed.each do |build|
+ if build.retryable?
+ Ci::Build.retry(build)
+ end
+ end
+
+ redirect_to ci_namespace_project_commit_path(project.namespace, project, commit.sha)
+ end
def branches
@branches = @project.repository.branch_names_contains(commit.id)
diff --git a/app/views/projects/commit/ci.html.haml b/app/views/projects/commit/ci.html.haml
index 6914cb9d876..2c535eb1867 100644
--- a/app/views/projects/commit/ci.html.haml
+++ b/app/views/projects/commit/ci.html.haml
@@ -26,6 +26,9 @@
&nbsp;
- if @ci_project && current_user && can?(current_user, :manage_builds, @project)
+ - if @ci_commit.builds.latest.failed.any?(&:retryable?)
+ = link_to "Retry failed", retry_ci_namespace_project_commit_path(@project.namespace, @project, @commit.sha), class: 'btn btn-xs btn-primary', method: :post
+
- if @ci_commit.builds.running_or_pending.any?
= link_to "Cancel all", cancel_builds_namespace_project_commit_path(@project.namespace, @project, @commit.sha), class: 'btn btn-xs btn-danger'
diff --git a/config/routes.rb b/config/routes.rb
index 3dbe2c4dfcc..e8d4119651c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -475,6 +475,7 @@ Gitlab::Application.routes.draw do
get :branches
get :ci
get :cancel_builds
+ post :retry_builds
end
end