diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-31 15:26:00 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-31 15:26:00 +0200 |
commit | bc621eef541139502201884e49a03f9467ab08fc (patch) | |
tree | 1d9158abbdfc1f71b3a8b6f77f212bc0d81c8910 | |
parent | ba81c91255aac2d724ceb94e3eb91f912227e2eb (diff) | |
download | gitlab-ce-bc621eef541139502201884e49a03f9467ab08fc.tar.gz |
Pipelines can be canceled only when there are running builds
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/ci/commit.rb | 4 | ||||
-rw-r--r-- | app/views/projects/ci/commits/_commit.html.haml | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG index 98e24dc63b1..1c09393f14e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,7 @@ v 8.9.0 (unreleased) - Fix issues filter when ordering by milestone - Todos will display target state if issuable target is 'Closed' or 'Merged' - Remove 'main language' feature + - Pipelines can be canceled only when there are running builds - Projects pending deletion will render a 404 page - Measure queue duration between gitlab-workhorse and Rails - Make authentication service for Container Registry to be compatible with < Docker 1.11 diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 6675a3f5d53..f22b573a94c 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -66,6 +66,10 @@ module Ci end end + def cancelable? + builds.running_or_pending.any? + end + def cancel_running builds.running_or_pending.each(&:cancel) end diff --git a/app/views/projects/ci/commits/_commit.html.haml b/app/views/projects/ci/commits/_commit.html.haml index 5b6b940a0c4..5e3a4123a8e 100644 --- a/app/views/projects/ci/commits/_commit.html.haml +++ b/app/views/projects/ci/commits/_commit.html.haml @@ -63,9 +63,9 @@ %span #{build.name} - if can?(current_user, :update_pipeline, @project) - - if commit.retryable? && commit.builds.failed.any? + - if commit.retryable? = link_to retry_namespace_project_pipeline_path(@project.namespace, @project, commit.id), class: 'btn has-tooltip', title: "Retry", method: :post do = icon("repeat") - - if commit.active? + - if commit.cancelable? = link_to cancel_namespace_project_pipeline_path(@project.namespace, @project, commit.id), class: 'btn btn-remove has-tooltip', title: "Cancel", method: :post do = icon("remove") |