summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 8aba74bedbc..2f0596c93cc 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -32,6 +32,8 @@ class CommitStatus < ApplicationRecord
where(allow_failure: true, status: [:failed, :canceled])
end
+ scope :order_id_desc, -> { order('ci_builds.id DESC') }
+
scope :exclude_ignored, -> do
# We want to ignore failed but allowed to fail jobs.
#
@@ -77,9 +79,9 @@ class CommitStatus < ApplicationRecord
merge(or_conditions)
end
- # We use `CommitStatusEnums.failure_reasons` here so that EE can more easily
+ # We use `Enums::CommitStatus.failure_reasons` here so that EE can more easily
# extend this `Hash` with new values.
- enum_with_nil failure_reason: ::CommitStatusEnums.failure_reasons
+ enum_with_nil failure_reason: Enums::CommitStatus.failure_reasons
##
# We still create some CommitStatuses outside of CreatePipelineService.
@@ -199,7 +201,14 @@ class CommitStatus < ApplicationRecord
end
def group_name
- name.to_s.gsub(%r{\d+[\s:/\\]+\d+\s*}, '').strip
+ # 'rspec:linux: 1/10' => 'rspec:linux'
+ common_name = name.to_s.gsub(%r{\d+[\s:\/\\]+\d+\s*}, '')
+
+ # 'rspec:linux: [aws, max memory]' => 'rspec:linux'
+ common_name.gsub!(%r{: \[.*, .*\]\s*\z}, '')
+
+ common_name.strip!
+ common_name
end
def failed_but_allowed?