diff options
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index ea2f425c5f6..524429bf12a 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -52,7 +52,6 @@ class CommitStatus < ApplicationRecord scope :before_stage, -> (index) { where('stage_idx < ?', index) } scope :for_stage, -> (index) { where(stage_idx: index) } scope :after_stage, -> (index) { where('stage_idx > ?', index) } - scope :for_ids, -> (ids) { where(id: ids) } scope :for_ref, -> (ref) { where(ref: ref) } scope :by_name, -> (name) { where(name: name) } scope :in_pipelines, ->(pipelines) { where(pipeline: pipelines) } @@ -85,6 +84,8 @@ class CommitStatus < ApplicationRecord # extend this `Hash` with new values. enum_with_nil failure_reason: Enums::Ci::CommitStatus.failure_reasons + default_value_for :retried, false + ## # We still create some CommitStatuses outside of CreatePipelineService. # @@ -291,6 +292,14 @@ class CommitStatus < ApplicationRecord failed? && !unrecoverable_failure? end + def update_older_statuses_retried! + self.class + .latest + .where(name: name) + .where.not(id: id) + .update_all(retried: true, processed: true) + end + private def unrecoverable_failure? |