summaryrefslogtreecommitdiff
path: root/app/models/ci/commit.rb
diff options
context:
space:
mode:
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)