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.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 412ab44aaf6..f2667e5476b 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -26,7 +26,10 @@ module Ci
has_many :builds, class_name: 'Ci::Build'
has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest'
+ delegate :stages, to: :statuses
+
validates_presence_of :sha
+ validates_presence_of :status
validate :valid_commit_sha
# Invalidate object and save if when touched
@@ -40,10 +43,6 @@ module Ci
CommitStatus.where(commit: all).stages
end
- def stages
- statuses.stages
- end
-
def project_id
project.id
end
@@ -82,7 +81,7 @@ module Ci
def retryable?
builds.latest.any? do |build|
- build.failed? || build.retryable?
+ build.failed? && build.retryable?
end
end