Skip to content
Snippets Groups Projects
Unverified Commit 7f5e11fd authored by Furkan Ayhan's avatar Furkan Ayhan Committed by GitLab
Browse files

Merge branch '470827-remove-ci_variables_optimization_for_yaml_and_node' into 'master'

Remove FF ci_variables_optimization_for_yaml_and_node

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169548



Merged-by: default avatarFurkan Ayhan <furkanayhn@gmail.com>
Approved-by: default avatarRajendra Kadam <rkadam@gitlab.com>
parents 0f8a4143 e57de1b1
No related branches found
No related tags found
No related merge requests found
---
name: ci_variables_optimization_for_yaml_and_node
feature_issue_url: https://gitlab.com/groups/gitlab-org/-/epics/14348
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158428
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/470827
milestone: '17.2'
group: group::pipeline authoring
type: beta
default_enabled: true
Loading
Loading
@@ -16,19 +16,15 @@ def initialize(pipeline, attributes = {})
end
 
def variables
if Feature.enabled?(:ci_variables_optimization_for_yaml_and_node, project)
pipeline
.variables_builder
.scoped_variables_for_pipeline_seed(
attributes,
user: pipeline.user,
trigger_request: pipeline.legacy_trigger,
environment: seed_environment,
kubernetes_namespace: seed_kubernetes_namespace
)
else
stub_build.scoped_variables
end
pipeline
.variables_builder
.scoped_variables_for_pipeline_seed(
attributes,
user: pipeline.user,
trigger_request: pipeline.legacy_trigger,
environment: seed_environment,
kubernetes_namespace: seed_kubernetes_namespace
)
end
strong_memoize_attr :variables
 
Loading
Loading
@@ -65,33 +61,6 @@ def simple_variables
)
end
strong_memoize_attr :simple_variables
def stub_build
# This is a temporary piece of technical debt to allow us access
# to the CI variables to evaluate rules before we persist a Build
# with the result. We should refactor away the extra Build.new,
# but be able to get CI Variables directly from the Seed::Build.
::Ci::Build.new(build_attributes)
end
# Assigning tags and needs is slow and they are not needed for rules
# evaluation since we don't use them to compute the variables at this point.
def build_attributes
attributes
.except(:tag_list, :needs_attributes)
.merge!(pipeline_attributes, ci_stage_attributes)
end
def ci_stage_attributes
{
ci_stage: ::Ci::Stage.new(
name: attributes[:stage],
position: attributes[:stage_idx],
pipeline: pipeline_attributes[:pipeline],
project: pipeline_attributes[:project]
)
}
end
end
end
end
Loading
Loading
Loading
Loading
@@ -70,14 +70,6 @@
 
it_behaves_like 'variables collection'
 
context 'when the FF ci_variables_optimization_for_yaml_and_node is disabled' do
before do
stub_feature_flags(ci_variables_optimization_for_yaml_and_node: false)
end
it_behaves_like 'variables collection'
end
context 'when the pipeline has a trigger request' do
let!(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline) }
 
Loading
Loading
@@ -85,21 +77,6 @@
expect(variables).to include('CI_PIPELINE_TRIGGERED' => 'true')
expect(variables).to include('CI_TRIGGER_SHORT_TOKEN' => trigger_request.trigger_short_token)
end
context 'when the FF ci_variables_optimization_for_yaml_and_node is disabled' do
before do
stub_feature_flags(ci_variables_optimization_for_yaml_and_node: false)
end
context 'when the pipeline has a trigger request' do
let!(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline) }
it 'includes trigger variables' do
expect(variables).to include('CI_PIPELINE_TRIGGERED' => 'true')
expect(variables).to include('CI_TRIGGER_SHORT_TOKEN' => trigger_request.trigger_short_token)
end
end
end
end
 
context 'when environment and kubernetes namespace include variables' do
Loading
Loading
@@ -130,17 +107,6 @@
is_expected.to include('CI_ENVIRONMENT_NAME' => 'env-master')
is_expected.to include('KUBE_NAMESPACE' => "k8s-#{project.full_path}")
end
context 'when the FF ci_variables_optimization_for_yaml_and_node is disabled' do
before do
stub_feature_flags(ci_variables_optimization_for_yaml_and_node: false)
end
it 'returns a collection of variables' do
is_expected.to include('CI_ENVIRONMENT_NAME' => 'env-master')
is_expected.to include('KUBE_NAMESPACE' => "k8s-#{project.full_path}")
end
end
end
 
context 'when environment includes nested variables' do
Loading
Loading
@@ -160,16 +126,6 @@
it 'expands the nested variable' do
is_expected.to include('CI_ENVIRONMENT_NAME' => 'env-nested-master')
end
context 'when the FF ci_variables_optimization_for_yaml_and_node is disabled' do
before do
stub_feature_flags(ci_variables_optimization_for_yaml_and_node: false)
end
it 'expands the nested variable' do
is_expected.to include('CI_ENVIRONMENT_NAME' => 'env-nested-master')
end
end
end
 
context 'when kubernetes namespace includes nested variables' do
Loading
Loading
@@ -202,16 +158,6 @@
it 'does not expand the nested variable' do
is_expected.to include('KUBE_NAMESPACE' => "k8s-nested-$CI_PROJECT_PATH")
end
context 'when the FF ci_variables_optimization_for_yaml_and_node is disabled' do
before do
stub_feature_flags(ci_variables_optimization_for_yaml_and_node: false)
end
it 'does not expand the nested variable' do
is_expected.to include('KUBE_NAMESPACE' => "k8s-nested-$CI_PROJECT_PATH")
end
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment