summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-01-23 14:49:12 -0800
committerValery Sizov <valery@gitlab.com>2015-01-23 14:55:47 -0800
commit23f0e93d4b02ced8a010f8f74def0bf286fc6ae5 (patch)
tree17d521fa3f43939e51e807357dce9c7af8cac46a
parent3540fb595542b690806d83412f93e2e651c029d4 (diff)
downloadgitlab-ci-23f0e93d4b02ced8a010f8f74def0bf286fc6ae5.tar.gz
disable retry button for old builds
-rw-r--r--app/controllers/builds_controller.rb4
-rw-r--r--app/views/builds/_build.html.haml2
-rw-r--r--app/views/builds/show.html.haml2
-rw-r--r--spec/factories/builds.rb1
4 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/builds_controller.rb b/app/controllers/builds_controller.rb
index d8ebcc0..93c44e9 100644
--- a/app/controllers/builds_controller.rb
+++ b/app/controllers/builds_controller.rb
@@ -34,6 +34,10 @@ class BuildsController < ApplicationController
end
def retry
+ if @build.commands.blank?
+ return page_404
+ end
+
build = Build.retry(@build)
if params[:return_to]
diff --git a/app/views/builds/_build.html.haml b/app/views/builds/_build.html.haml
index 2cd3d7c..271ceed 100644
--- a/app/views/builds/_build.html.haml
+++ b/app/views/builds/_build.html.haml
@@ -44,6 +44,6 @@
- if build.active?
= link_to cancel_project_build_path(build.project, build, return_to: request.original_url), title: 'Cancel build' do
%i.icon-remove.cred
- - else
+ - elsif build.commands.present?
= link_to retry_project_build_path(build.project, build, return_to: request.original_url), method: :post, title: 'Retry build' do
%i.icon-repeat
diff --git a/app/views/builds/show.html.haml b/app/views/builds/show.html.haml
index d1a0844..9d8a933 100644
--- a/app/views/builds/show.html.haml
+++ b/app/views/builds/show.html.haml
@@ -86,7 +86,7 @@
.pull-right
- if @build.active?
= link_to "Cancel", cancel_project_build_path(@project, @build), class: 'btn btn-sm btn-danger'
- - else
+ - elsif @build.commands.present?
= link_to "Retry", retry_project_build_path(@project, @build), class: 'btn btn-sm btn-primary', method: :post
- if @build.duration
diff --git a/spec/factories/builds.rb b/spec/factories/builds.rb
index eacdd76..369f4ee 100644
--- a/spec/factories/builds.rb
+++ b/spec/factories/builds.rb
@@ -28,5 +28,6 @@ FactoryGirl.define do
factory :build do
started_at 'Di 29. Okt 09:51:28 CET 2013'
finished_at 'Di 29. Okt 09:53:28 CET 2013'
+ commands 'ls -a'
end
end