Commit b368a45c authored by David Kim's avatar David Kim

Merge branch 'remove-group-name-feature-flag' into 'master'

Remove simplified build group name feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!57739
parents 9fea86e8 9846e59a
......@@ -213,26 +213,7 @@ class CommitStatus < ApplicationRecord
end
def group_name
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}, '')
common_name.strip!
common_name
end
name.to_s.sub(%r{([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+)))+\s*\z}, '').strip
end
def failed_but_allowed?
......
---
title: Simplify Build Group name correction
merge_request: 57739
author:
type: fixed
---
name: simplified_commit_status_group_name
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52644
rollout_issue_url:
milestone: '13.9'
type: development
group: group::testing
default_enabled: false
......@@ -137,24 +137,14 @@ The jobs are ordered by comparing the numbers from left to right. You
usually want the first number to be the index and the second number to be the total.
[This regular expression](https://gitlab.com/gitlab-org/gitlab/blob/2f3dc314f42dbd79813e6251792853bc231e69dd/app/models/commit_status.rb#L99)
evaluates the job names: `\d+[\s:\/\\]+\d+\s*`.
### Improved job grouping
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52644) in GitLab 13.9.
> - It's [deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
> - It's enabled on GitLab.com.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](../../administration/feature_flags.md). **(FREE SELF)**
Job grouping is evaluated with an improved regular expression to group jobs by name:
- `([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+)))+\s*\z`.
The new implementation removes one or more `: [...]`, `X Y`, `X/Y`, or `X\Y` sequences
from the **end** of job names only.
Matching substrings occurring at the beginning or in the middle of build names are
no longer removed.
evaluates the job names: `([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+)))+\s*\z`.
One or more `: [...]`, `X Y`, `X/Y`, or `X\Y` sequences are removed from the **end**
of job names only. Matching substrings found at the beginning or in the middle of
job names are not removed.
In [GitLab 13.8 and earlier](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52644),
the regular expression is `\d+[\s:\/\\]+\d+\s*`. [Feature flag](../../user/feature_flags.md)
removed in [GitLab 13.11](https://gitlab.com/gitlab-org/gitlab/-/issues/322080).
## Specifying variables when running manual jobs
......
......@@ -510,10 +510,6 @@ RSpec.describe CommitStatus do
end
describe '#group_name' do
before do
stub_feature_flags(simplified_commit_status_group_name: false)
end
using RSpec::Parameterized::TableSyntax
let(:commit_status) do
......@@ -528,18 +524,24 @@ RSpec.describe CommitStatus do
'rspec1 0/2' | 'rspec1'
'rspec:windows' | 'rspec:windows'
'rspec:windows 0' | 'rspec:windows 0'
'rspec:windows 0 2/2' | 'rspec:windows 0'
'rspec:windows 0 test' | 'rspec:windows 0 test'
'rspec:windows 0 1' | 'rspec:windows'
'rspec:windows 0 1 name' | 'rspec:windows name'
'rspec:windows 0 test 2/2' | 'rspec:windows 0 test'
'rspec:windows 0 1 2/2' | 'rspec:windows'
'rspec:windows 0 1 [aws] 2/2' | 'rspec:windows'
'rspec:windows 0 1 name [aws] 2/2' | 'rspec:windows 0 1 name'
'rspec:windows 0 1 name' | 'rspec:windows 0 1 name'
'rspec:windows 0 1 name 1/2' | 'rspec:windows 0 1 name'
'rspec:windows 0/1' | 'rspec:windows'
'rspec:windows 0/1 name' | 'rspec:windows name'
'rspec:windows 0/1 name' | 'rspec:windows 0/1 name'
'rspec:windows 0/1 name 1/2' | 'rspec:windows 0/1 name'
'rspec:windows 0:1' | 'rspec:windows'
'rspec:windows 0:1 name' | 'rspec:windows name'
'rspec:windows 0:1 name' | 'rspec:windows 0:1 name'
'rspec:windows 10000 20000' | 'rspec:windows'
'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'
'rspec:windows 0 : / 1 name' | 'rspec:windows 0 : / 1 name'
'0 1 name ruby' | '0 1 name ruby'
'0 :/ 1 name ruby' | '0 :/ 1 name ruby'
'rspec: [aws]' | 'rspec'
'rspec: [aws] 0/1' | 'rspec'
'rspec: [aws, max memory]' | 'rspec'
......@@ -561,58 +563,6 @@ RSpec.describe CommitStatus do
is_expected.to eq(group_name)
end
end
context 'with simplified_commit_status_group_name' do
before do
stub_feature_flags(simplified_commit_status_group_name: true)
end
where(:name, :group_name) do
'rspec1' | 'rspec1'
'rspec1 0 1' | 'rspec1'
'rspec1 0/2' | 'rspec1'
'rspec:windows' | 'rspec:windows'
'rspec:windows 0' | 'rspec:windows 0'
'rspec:windows 0 2/2' | 'rspec:windows 0'
'rspec:windows 0 test' | 'rspec:windows 0 test'
'rspec:windows 0 test 2/2' | 'rspec:windows 0 test'
'rspec:windows 0 1 2/2' | 'rspec:windows'
'rspec:windows 0 1 [aws] 2/2' | 'rspec:windows'
'rspec:windows 0 1 name [aws] 2/2' | 'rspec:windows 0 1 name'
'rspec:windows 0 1 name' | 'rspec:windows 0 1 name'
'rspec:windows 0 1 name 1/2' | 'rspec:windows 0 1 name'
'rspec:windows 0/1' | 'rspec:windows'
'rspec:windows 0/1 name' | 'rspec:windows 0/1 name'
'rspec:windows 0/1 name 1/2' | 'rspec:windows 0/1 name'
'rspec:windows 0:1' | 'rspec:windows'
'rspec:windows 0:1 name' | 'rspec:windows 0:1 name'
'rspec:windows 10000 20000' | 'rspec:windows'
'rspec:windows 0 : / 1' | 'rspec:windows'
'rspec:windows 0 : / 1 name' | 'rspec:windows 0 : / 1 name'
'0 1 name ruby' | '0 1 name ruby'
'0 :/ 1 name ruby' | '0 :/ 1 name ruby'
'rspec: [aws]' | 'rspec'
'rspec: [aws] 0/1' | 'rspec'
'rspec: [aws, max memory]' | 'rspec'
'rspec:linux: [aws, max memory, data]' | 'rspec:linux'
'rspec: [inception: [something, other thing], value]' | 'rspec'
'rspec:windows 0/1: [name, other]' | 'rspec:windows'
'rspec:windows: [name, other] 0/1' | 'rspec:windows'
'rspec:windows: [name, 0/1] 0/1' | 'rspec:windows'
'rspec:windows: [0/1, name]' | 'rspec:windows'
'rspec:windows: [, ]' | 'rspec:windows'
'rspec:windows: [name]' | 'rspec:windows'
'rspec:windows: [name,other]' | 'rspec:windows'
end
with_them do
it "#{params[:name]} puts in #{params[:group_name]}" do
commit_status.name = name
is_expected.to eq(group_name)
end
end
end
end
describe '#detailed_status' do
......
......@@ -76,8 +76,8 @@ RSpec.describe Ci::DagPipelineEntity do
it 'performs the smallest number of queries', :request_store do
log = ActiveRecord::QueryRecorder.new { subject }
# stages, project, builds, build_needs, feature_flag
expect(log.count).to eq 5
# stages, project, builds, build_needs
expect(log.count).to eq 4
end
it 'contains all the data' do
......
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