From fe2137d871b978033007a3375cf6f1edf0f04cd4 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 10 May 2016 02:26:13 +0300 Subject: Improve pipelines design --- app/models/ci/commit.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models/ci/commit.rb') 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) -- cgit v1.2.1