Commit a549710e authored by Marius Bobin's avatar Marius Bobin Committed by Robert Speicher

Remove feature flag related code

Removes feature flag checks and reverts spec files to using
fast_spec_helper
parent ad06f01c
...@@ -203,7 +203,7 @@ class CommitStatus < ApplicationRecord ...@@ -203,7 +203,7 @@ class CommitStatus < ApplicationRecord
common_name = name.to_s.gsub(%r{\d+[\s:\/\\]+\d+\s*}, '') common_name = name.to_s.gsub(%r{\d+[\s:\/\\]+\d+\s*}, '')
# 'rspec:linux: [aws, max memory]' => 'rspec:linux' # 'rspec:linux: [aws, max memory]' => 'rspec:linux'
common_name.gsub!(%r{: \[.*, .*\]\s*\z}, '') if Gitlab::Ci::Features.new_matrix_job_names_enabled? common_name.gsub!(%r{: \[.*, .*\]\s*\z}, '')
common_name.strip! common_name.strip!
common_name common_name
......
---
title: Parallel matrix jobs show relevant variables in job name
merge_request: 41080
author:
type: added
---
name: ci_matrix_job_names
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39985
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/239012
group: 'group::continuous integration'
type: development
default_enabled: false
...@@ -3589,17 +3589,19 @@ deploystacks: ...@@ -3589,17 +3589,19 @@ deploystacks:
This generates 10 parallel `deploystacks` jobs, each with different values for `PROVIDER` and `STACK`: This generates 10 parallel `deploystacks` jobs, each with different values for `PROVIDER` and `STACK`:
```plaintext ```plaintext
deploystacks 1/10 with PROVIDER=aws and STACK=monitoring deploystacks: [aws, monitoring]
deploystacks 2/10 with PROVIDER=aws and STACK=app1 deploystacks: [aws, app1]
deploystacks 3/10 with PROVIDER=aws and STACK=app2 deploystacks: [aws, app2]
deploystacks 4/10 with PROVIDER=ovh and STACK=monitoring deploystacks: [ovh, monitoring]
deploystacks 5/10 with PROVIDER=ovh and STACK=backup deploystacks: [ovh, backup]
deploystacks 6/10 with PROVIDER=ovh and STACK=app deploystacks: [ovh, app]
deploystacks 7/10 with PROVIDER=gcp and STACK=data deploystacks: [gcp, data]
deploystacks 8/10 with PROVIDER=gcp and STACK=processing deploystacks: [gcp, processing]
deploystacks 9/10 with PROVIDER=vultr and STACK=data deploystacks: [vultr, data]
deploystacks 10/10 with PROVIDER=vultr and STACK=processing deploystacks: [vultr, processing]
``` ```
Job naming style [was improved](https://gitlab.com/gitlab-org/gitlab/-/issues/230452) in GitLab 13.4.
### `trigger` ### `trigger`
......
...@@ -49,16 +49,6 @@ module Gitlab ...@@ -49,16 +49,6 @@ module Gitlab
end end
def name def name
if Gitlab::Ci::Features.new_matrix_job_names_enabled?
name_with_variable_details
else
old_name
end
end
private
def name_with_variable_details
vars = variables vars = variables
.values .values
.compact .compact
...@@ -67,9 +57,7 @@ module Gitlab ...@@ -67,9 +57,7 @@ module Gitlab
"#{job_name}: [#{vars}]" "#{job_name}: [#{vars}]"
end end
def old_name private
"#{job_name} #{instance}/#{total}"
end
attr_reader :job_name, :instance, :variables, :total attr_reader :job_name, :instance, :variables, :total
end end
......
...@@ -72,10 +72,6 @@ module Gitlab ...@@ -72,10 +72,6 @@ module Gitlab
Feature.enabled?(:project_transactionless_destroy, project, default_enabled: false) Feature.enabled?(:project_transactionless_destroy, project, default_enabled: false)
end end
def self.new_matrix_job_names_enabled?
::Feature.enabled?(:ci_matrix_job_names, default_enabled: false)
end
def self.coverage_report_view?(project) def self.coverage_report_view?(project)
::Feature.enabled?(:coverage_report_view, project) ::Feature.enabled?(:coverage_report_view, project)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do
describe '.applies_to?' do describe '.applies_to?' do
...@@ -39,114 +39,53 @@ RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do ...@@ -39,114 +39,53 @@ RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do
it { expect(subject.size).to eq(4) } it { expect(subject.size).to eq(4) }
context 'with new_matrix_job_names_enabled ff disabled' do it 'has attributes' do
before do expect(subject.map(&:attributes)).to match_array(
stub_feature_flags(ci_matrix_job_names: false) [
end {
name: 'test: [aws, app1]',
it 'has attributes' do instance: 1,
expect(subject.map(&:attributes)).to match_array( parallel: { total: 4 },
[ variables: {
{ 'PROVIDER' => 'aws',
name: 'test 1/4', 'STACK' => 'app1'
instance: 1,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'aws',
'STACK' => 'app1'
}
},
{
name: 'test 2/4',
instance: 2,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'aws',
'STACK' => 'app2'
}
},
{
name: 'test 3/4',
instance: 3,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'ovh',
'STACK' => 'app'
}
},
{
name: 'test 4/4',
instance: 4,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'gcp',
'STACK' => 'app'
}
} }
] },
) {
end name: 'test: [aws, app2]',
instance: 2,
it 'has parallelized name' do parallel: { total: 4 },
expect(subject.map(&:name)).to match_array( variables: {
['test 1/4', 'test 2/4', 'test 3/4', 'test 4/4'] 'PROVIDER' => 'aws',
) 'STACK' => 'app2'
end
end
context 'with new_matrix_job_names_enabled ff enabled' do
before do
stub_feature_flags(ci_matrix_job_names: true)
end
it 'has attributes' do
expect(subject.map(&:attributes)).to match_array(
[
{
name: 'test: [aws, app1]',
instance: 1,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'aws',
'STACK' => 'app1'
}
},
{
name: 'test: [aws, app2]',
instance: 2,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'aws',
'STACK' => 'app2'
}
},
{
name: 'test: [ovh, app]',
instance: 3,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'ovh',
'STACK' => 'app'
}
},
{
name: 'test: [gcp, app]',
instance: 4,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'gcp',
'STACK' => 'app'
}
} }
] },
) {
end name: 'test: [ovh, app]',
instance: 3,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'ovh',
'STACK' => 'app'
}
},
{
name: 'test: [gcp, app]',
instance: 4,
parallel: { total: 4 },
variables: {
'PROVIDER' => 'gcp',
'STACK' => 'app'
}
}
]
)
end
it 'has parallelized name' do it 'has parallelized name' do
expect(subject.map(&:name)).to match_array( expect(subject.map(&:name)).to match_array(
['test: [aws, app1]', 'test: [aws, app2]', 'test: [gcp, app]', 'test: [ovh, app]'] ['test: [aws, app1]', 'test: [aws, app2]', 'test: [gcp, app]', 'test: [ovh, app]']
) )
end
end end
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
RSpec.describe Gitlab::Ci::Config::Normalizer do RSpec.describe Gitlab::Ci::Config::Normalizer do
let(:job_name) { :rspec } let(:job_name) { :rspec }
...@@ -185,6 +185,13 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do ...@@ -185,6 +185,13 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do
} }
end end
let(:expanded_job_names) do
[
'rspec: [A, B]',
'rspec: [A, C]'
]
end
it 'does not have original job' do it 'does not have original job' do
is_expected.not_to include(job_name) is_expected.not_to include(job_name)
end end
...@@ -215,45 +222,12 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do ...@@ -215,45 +222,12 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do
expect(configs).to all(match(a_hash_including(original_config))) expect(configs).to all(match(a_hash_including(original_config)))
end end
context 'with new_matrix_job_names_enabled ff enabled' do it 'has parallelized jobs' do
let(:expanded_job_names) do is_expected.to include(*expanded_job_names.map(&:to_sym))
[
'rspec: [A, B]',
'rspec: [A, C]'
]
end
before do
stub_feature_flags(ci_matrix_job_names: true)
end
it 'has parallelized jobs' do
is_expected.to include(*expanded_job_names.map(&:to_sym))
end
it_behaves_like 'parallel dependencies'
it_behaves_like 'parallel needs'
end end
context 'with new_matrix_job_names_enabled ff disabled' do it_behaves_like 'parallel dependencies'
let(:expanded_job_names) do it_behaves_like 'parallel needs'
[
'rspec 1/2',
'rspec 2/2'
]
end
before do
stub_feature_flags(ci_matrix_job_names: false)
end
it 'has parallelized jobs' do
is_expected.to include(*expanded_job_names.map(&:to_sym))
end
it_behaves_like 'parallel dependencies'
it_behaves_like 'parallel needs'
end
end end
context 'when parallel config does not matches a factory' do context 'when parallel config does not matches a factory' 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