Commit b814bc73 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'matrix-job-names-rollout' into 'master'

Matrix job names rollout

See merge request gitlab-org/gitlab!41080
parents 0b71840f a549710e
......@@ -203,7 +203,7 @@ class CommitStatus < ApplicationRecord
common_name = name.to_s.gsub(%r{\d+[\s:\/\\]+\d+\s*}, '')
# '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
......
---
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
......@@ -3594,17 +3594,19 @@ deploystacks:
This generates 10 parallel `deploystacks` jobs, each with different values for `PROVIDER` and `STACK`:
```plaintext
deploystacks 1/10 with PROVIDER=aws and STACK=monitoring
deploystacks 2/10 with PROVIDER=aws and STACK=app1
deploystacks 3/10 with PROVIDER=aws and STACK=app2
deploystacks 4/10 with PROVIDER=ovh and STACK=monitoring
deploystacks 5/10 with PROVIDER=ovh and STACK=backup
deploystacks 6/10 with PROVIDER=ovh and STACK=app
deploystacks 7/10 with PROVIDER=gcp and STACK=data
deploystacks 8/10 with PROVIDER=gcp and STACK=processing
deploystacks 9/10 with PROVIDER=vultr and STACK=data
deploystacks 10/10 with PROVIDER=vultr and STACK=processing
```
deploystacks: [aws, monitoring]
deploystacks: [aws, app1]
deploystacks: [aws, app2]
deploystacks: [ovh, monitoring]
deploystacks: [ovh, backup]
deploystacks: [ovh, app]
deploystacks: [gcp, data]
deploystacks: [gcp, processing]
deploystacks: [vultr, data]
deploystacks: [vultr, processing]
```
Job naming style [was improved](https://gitlab.com/gitlab-org/gitlab/-/issues/230452) in GitLab 13.4.
### `trigger`
......
......@@ -49,16 +49,6 @@ module Gitlab
end
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
.values
.compact
......@@ -67,9 +57,7 @@ module Gitlab
"#{job_name}: [#{vars}]"
end
def old_name
"#{job_name} #{instance}/#{total}"
end
private
attr_reader :job_name, :instance, :variables, :total
end
......
......@@ -67,10 +67,6 @@ module Gitlab
Feature.enabled?(:project_transactionless_destroy, project, default_enabled: false)
end
def self.new_matrix_job_names_enabled?
::Feature.enabled?(:ci_matrix_job_names, default_enabled: false)
end
def self.coverage_report_view?(project)
::Feature.enabled?(:coverage_report_view, project)
end
......
# frozen_string_literal: true
require 'spec_helper'
require 'fast_spec_helper'
RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do
describe '.applies_to?' do
......@@ -39,66 +39,6 @@ RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do
it { expect(subject.size).to eq(4) }
context 'with new_matrix_job_names_enabled ff disabled' do
before do
stub_feature_flags(ci_matrix_job_names: false)
end
it 'has attributes' do
expect(subject.map(&:attributes)).to match_array(
[
{
name: 'test 1/4',
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
it 'has parallelized name' do
expect(subject.map(&:name)).to match_array(
['test 1/4', 'test 2/4', 'test 3/4', 'test 4/4']
)
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(
[
......@@ -148,5 +88,4 @@ RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do
)
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
require 'fast_spec_helper'
RSpec.describe Gitlab::Ci::Config::Normalizer do
let(:job_name) { :rspec }
......@@ -185,6 +185,13 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do
}
end
let(:expanded_job_names) do
[
'rspec: [A, B]',
'rspec: [A, C]'
]
end
it 'does not have original job' do
is_expected.not_to include(job_name)
end
......@@ -215,18 +222,6 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do
expect(configs).to all(match(a_hash_including(original_config)))
end
context 'with new_matrix_job_names_enabled ff enabled' do
let(:expanded_job_names) do
[
'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
......@@ -235,27 +230,6 @@ RSpec.describe Gitlab::Ci::Config::Normalizer do
it_behaves_like 'parallel needs'
end
context 'with new_matrix_job_names_enabled ff disabled' do
let(:expanded_job_names) do
[
'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
context 'when parallel config does not matches a factory' do
let(:variables_config) { {} }
let(:parallel_config) { }
......
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