diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/models/commit_status.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
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? |