summaryrefslogtreecommitdiff
path: root/app/models/ci/commit.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-10 02:26:13 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-10 02:26:13 +0300
commitfe2137d871b978033007a3375cf6f1edf0f04cd4 (patch)
treee75b2aca3150efd6433314fb57e10c6ba763db6e /app/models/ci/commit.rb
parent504a1fac95a2af2cf90f00f310d244d8d37f0015 (diff)
downloadgitlab-ce-fe2137d871b978033007a3375cf6f1edf0f04cd4.tar.gz
Improve pipelines design
Diffstat (limited to 'app/models/ci/commit.rb')
-rw-r--r--app/models/ci/commit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 759c31b0055..71696a3923c 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -89,6 +89,14 @@ module Ci
end
end
+ def cancel_running
+ builds.running_or_pending.each(&:cancel)
+ end
+
+ def retry_failed
+ builds.latest.failed.select(&:retryable?).each(&:retry)
+ end
+
def latest?
return false unless ref
commit = project.commit(ref)