Pipelines can be canceled only when there are running builds

This commit is contained in:
Kamil Trzcinski 2016-05-31 15:26:00 +02:00
parent ba81c91255
commit bc621eef54
3 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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")