summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-28 14:24:43 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-30 11:06:19 +0200
commitf9c5f18d448de3fefced3149550263adc83af1bf (patch)
treeee5f5b467ff1c53ec91c5c6003e77243a281b8af /app
parent94cec500c534ac8b35d7d7d9c807646faa800fec (diff)
downloadgitlab-ce-f9c5f18d448de3fefced3149550263adc83af1bf.tar.gz
Improve method that tells if build is retryable
This method now should return false if build is not completed. If build is running then it is not retryable, therefore `Ci::Build#retryable?` returned wrong value. This commit changes this behavior
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/views/projects/builds/_sidebar.html.haml2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 2b0bec33131..c11f8e6884d 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -90,7 +90,7 @@ module Ci
end
def retryable?
- project.builds_enabled? && commands.present?
+ project.builds_enabled? && commands.present? && complete?
end
def retried?
diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml
index a1dc79aaf5e..cab21f0cf19 100644
--- a/app/views/projects/builds/_sidebar.html.haml
+++ b/app/views/projects/builds/_sidebar.html.haml
@@ -40,7 +40,7 @@
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) }
.title
Build details
- - if @build.retryable? && !@build.active?
+ - if @build.retryable?
= link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post
- if @build.merge_request
%p.build-detail-row