summaryrefslogtreecommitdiff
path: root/app/models/ci/commit.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-01 10:10:39 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-01 10:10:39 +0200
commitfeec3a45eb517607d96f5553f36e7d35c97520ba (patch)
treedb037849302326f1ecdd2916687fadd00330cdba /app/models/ci/commit.rb
parent95b010fb73832b1bcfba884b9bcfd87d2954e44c (diff)
downloadgitlab-ce-ci-changes-refactor.tar.gz
Show pipelinesci-changes-refactor
Diffstat (limited to 'app/models/ci/commit.rb')
-rw-r--r--app/models/ci/commit.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index cd9ce0a283d..45309614115 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -67,6 +67,12 @@ module Ci
.pluck(:stage, :stage_idx).map(&:first)
end
+ def stages
+ statuses
+ .group(:stage, :stage_idx).order(:stage_idx)
+ .pluck(:stage, :stage_idx).map(&:first)
+ end
+
def to_param
sha
end
@@ -115,6 +121,12 @@ module Ci
Gitlab::Git::branch_ref?(origin_ref)
end
+ def retryable?
+ builds.latest.any? do |build|
+ build.failed? || build.retryable?
+ end
+ end
+
def create_builds(ref, tag, user, trigger_request = nil)
return unless config_processor
config_processor.stages.any? do |stage|