Commit 0ea5e79e authored by Furkan Ayhan's avatar Furkan Ayhan

Remove some ci_workflow_rules_variables FF checks

We had an incident about the feature flag rollout because it was enabled
by 10% of occurrences without any actor. So inconsistent behavior
happened. In this commit, we are removing unnecessary checks of the FF
and add an actor to the FF.
parent d749256a
......@@ -142,14 +142,10 @@ module Gitlab
end
def job_variables
return unless ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
variables_value.to_h
end
def root_variables_inheritance
return unless ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
inherit_entry&.variables_entry&.value
end
......
......@@ -44,7 +44,7 @@ module Gitlab
name: name,
instance: instance,
variables: variables, # https://gitlab.com/gitlab-org/gitlab/-/issues/300581
job_variables: job_variables,
job_variables: variables,
parallel: { total: total }
}.compact
end
......@@ -61,12 +61,6 @@ module Gitlab
private
attr_reader :job_name, :instance, :variables, :total
def job_variables
return unless ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
variables
end
end
end
end
......
......@@ -11,7 +11,7 @@ module Gitlab
def perform!
raise ArgumentError, 'missing YAML processor result' unless @command.yaml_processor_result
if ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
if ::Feature.enabled?(:ci_workflow_rules_variables, pipeline.project, default_enabled: :yaml)
raise ArgumentError, 'missing workflow rules result' unless @command.workflow_rules_result
end
......@@ -51,7 +51,7 @@ module Gitlab
end
def root_variables
if ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
if ::Feature.enabled?(:ci_workflow_rules_variables, pipeline.project, default_enabled: :yaml)
::Gitlab::Ci::Variables::Helpers.merge_variables(
@command.yaml_processor_result.root_variables, @command.workflow_rules_result.variables
)
......
......@@ -213,7 +213,7 @@ module Gitlab
end
def recalculate_yaml_variables!
return unless ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
return unless ::Feature.enabled?(:ci_workflow_rules_variables, @pipeline.project, default_enabled: :yaml)
@seed_attributes[:yaml_variables] = Gitlab::Ci::Variables::Helpers.inherit_yaml_variables(
from: @context.root_variables, to: @job_variables, inheritance: @root_variables_inheritance
......
......@@ -55,7 +55,7 @@ module Gitlab
{
tag_list: tags || [],
yaml_variables: yaml_variables, # https://gitlab.com/gitlab-org/gitlab/-/issues/300581
job_variables: job_variables,
job_variables: yaml_variables,
options: {
image: image_value,
services: services_value,
......@@ -74,12 +74,6 @@ module Gitlab
end
end
end
def job_variables
return unless ::Feature.enabled?(:ci_workflow_rules_variables, default_enabled: :yaml)
yaml_variables
end
end
end
end
......
......@@ -389,20 +389,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
end
end
context 'when FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'does not return job_variables and root_variables_inheritance' do
expect(entry.value).to include(
variables: { 'A' => 'job', 'B' => 'job' }
)
expect(entry.value).not_to have_key(:job_variables)
expect(entry.value).not_to have_key(:root_variables_inheritance)
end
end
context 'when root yaml variables are used' do
let(:variables) do
Gitlab::Ci::Config::Entry::Variables.new(
......@@ -520,21 +506,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
root_variables_inheritance: true
)
end
context 'when FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'does not return job_variables and root_variables_inheritance' do
expect(entry.value).to eq(
name: :rspec,
stage: 'test',
only: { refs: %w[branches tags] },
variables: {}
)
end
end
end
end
end
......
......@@ -107,54 +107,5 @@ RSpec.describe Gitlab::Ci::Config::Normalizer::MatrixStrategy do
['test: [aws, app1]', 'test: [aws, app2]', 'test: [gcp, app]', 'test: [ovh, app]']
)
end
context 'when the FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'excludes job_variables' 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
end
end
end
......@@ -151,26 +151,6 @@ RSpec.describe Gitlab::WebIde::Config::Entry::Terminal do
}
)
end
context 'when FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'returns correct value without job_variables' do
expect(entry.value)
.to eq(
tag_list: ['webide'],
yaml_variables: [{ key: 'KEY', value: 'value', public: true }],
options: {
image: { name: "ruby:2.5" },
services: [{ name: "mysql" }],
before_script: %w[ls pwd],
script: ['sleep 100']
}
)
end
end
end
end
end
......
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