diff options
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index c2aecc524d4..ea2f425c5f6 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -209,14 +209,26 @@ class CommitStatus < ApplicationRecord end def group_name - # 'rspec:linux: 1/10' => 'rspec:linux' - common_name = name.to_s.gsub(%r{\b\d+[\s:\/\\]+\d+\s*}, '') + simplified_commit_status_group_name_feature_flag = Gitlab::SafeRequestStore.fetch("project:#{project_id}:simplified_commit_status_group_name") do + Feature.enabled?(:simplified_commit_status_group_name, project, default_enabled: false) + end + + if simplified_commit_status_group_name_feature_flag + # Only remove one or more [...] "X/Y" "X Y" from the end of build names. + # More about the regular expression logic: https://docs.gitlab.com/ee/ci/jobs/#group-jobs-in-a-pipeline + + name.to_s.sub(%r{([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+)))+\s*\z}, '').strip + else + # Prior implementation, remove [...] "X/Y" "X Y" from the beginning and middle of build names + # 'rspec:linux: 1/10' => 'rspec:linux' + common_name = name.to_s.gsub(%r{\b\d+[\s:\/\\]+\d+\s*}, '') - # 'rspec:linux: [aws, max memory]' => 'rspec:linux', 'rspec:linux: [aws]' => 'rspec:linux' - common_name.gsub!(%r{: \[.*\]\s*\z}, '') + # 'rspec:linux: [aws, max memory]' => 'rspec:linux', 'rspec:linux: [aws]' => 'rspec:linux' + common_name.gsub!(%r{: \[.*\]\s*\z}, '') - common_name.strip! - common_name + common_name.strip! + common_name + end end def failed_but_allowed? @@ -256,15 +268,7 @@ class CommitStatus < ApplicationRecord end def all_met_to_become_pending? - !any_unmet_prerequisites? && !requires_resource? - end - - def any_unmet_prerequisites? - false - end - - def requires_resource? - false + true end def auto_canceled? |