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 /app/models/ci/commit.rb | |
| parent | ba81c91255aac2d724ceb94e3eb91f912227e2eb (diff) | |
| download | gitlab-ce-bc621eef541139502201884e49a03f9467ab08fc.tar.gz | |
Pipelines can be canceled only when there are running builds
Diffstat (limited to 'app/models/ci/commit.rb')
| -rw-r--r-- | app/models/ci/commit.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |
