Commit 4b37c7bf authored by Marius Bobin's avatar Marius Bobin

Update group_name regular expression to match matrix builds

parent b74ee551
......@@ -198,8 +198,19 @@ class CommitStatus < ApplicationRecord
will_save_change_to_status?
end
# Extracts common job name for matrix and parallel builds:
# 'rspec:linux: [aws, max memory]' => 'rspec:linux'
# 'rspec:linux: 1/10' => 'rspec:linux'
#
def group_name
name.to_s.gsub(%r{\d+[\s:/\\]+\d+\s*}, '').strip
if Gitlab::Ci::Features.new_matrix_job_names_enabled?
matches = name.to_s.match(/\A(.*?): \[+(.*, )+(.*)\]\z/)
group_name = matches.to_a[1] || name
else
group_name = name
end
group_name.to_s.gsub(%r{\d+[\s:/\\]+\d+\s*}, '').strip
end
def failed_but_allowed?
......
......@@ -510,7 +510,13 @@ RSpec.describe CommitStatus do
'rspec:windows 0 : / 1' => 'rspec:windows',
'rspec:windows 0 : / 1 name' => 'rspec:windows name',
'0 1 name ruby' => 'name ruby',
'0 :/ 1 name ruby' => 'name ruby'
'0 :/ 1 name ruby' => 'name ruby',
'rspec: [aws]' => 'rspec: [aws]',
'rspec: [aws] 0/1' => 'rspec: [aws]',
'rspec: [aws, max memory]' => 'rspec',
'rspec:linux: [aws, max memory]' => 'rspec:linux',
'rspec: [inception: [something, other thing], value]' => 'rspec',
'rspec:windows 0/1: [name, other]' => 'rspec:windows'
}
tests.each do |name, group_name|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment