Commit ef1f665f authored by Furkan Ayhan's avatar Furkan Ayhan

Merge branch 'ci-cleanup-predefined-variables-feature-flag' into 'master'

Remove ci_predefined_vars_in_builder feature flag

See merge request gitlab-org/gitlab!75009
parents f036fba7 31aa6433
......@@ -1276,12 +1276,6 @@ module Ci
self.builds.latest.build_matchers(project)
end
def predefined_vars_in_builder_enabled?
strong_memoize(:predefined_vars_in_builder_enabled) do
Feature.enabled?(:ci_predefined_vars_in_builder, project, default_enabled: :yaml)
end
end
def authorized_cluster_agents
strong_memoize(:authorized_cluster_agents) do
::Clusters::AgentAuthorizationsFinder.new(project).execute.map(&:agent)
......
......@@ -13,7 +13,6 @@ module Ci
track_duration do
variables = pipeline.variables_builder.scoped_variables(self, environment: environment, dependencies: dependencies)
variables.concat(predefined_variables) unless pipeline.predefined_vars_in_builder_enabled?
variables.concat(project.predefined_variables)
variables.concat(pipeline.predefined_variables)
variables.concat(runner.predefined_variables) if runnable? && runner
......@@ -71,24 +70,6 @@ module Ci
end
end
def predefined_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables|
variables.append(key: 'CI_JOB_NAME', value: name)
variables.append(key: 'CI_JOB_STAGE', value: stage)
variables.append(key: 'CI_JOB_MANUAL', value: 'true') if action?
variables.append(key: 'CI_PIPELINE_TRIGGERED', value: 'true') if trigger_request
variables.append(key: 'CI_NODE_INDEX', value: self.options[:instance].to_s) if self.options&.include?(:instance)
variables.append(key: 'CI_NODE_TOTAL', value: ci_node_total_value.to_s)
# legacy variables
variables.append(key: 'CI_BUILD_NAME', value: name)
variables.append(key: 'CI_BUILD_STAGE', value: stage)
variables.append(key: 'CI_BUILD_TRIGGERED', value: 'true') if trigger_request
variables.append(key: 'CI_BUILD_MANUAL', value: 'true') if action?
end
end
def kubernetes_variables
::Gitlab::Ci::Variables::Collection.new.tap do |collection|
# Should get merged with the cluster kubeconfig in deployment_variables, see
......@@ -123,13 +104,5 @@ module Ci
def secret_project_variables(environment: expanded_environment_name)
project.ci_variables_for(ref: git_ref, environment: environment)
end
private
def ci_node_total_value
parallel = self.options&.dig(:parallel)
parallel = parallel.dig(:total) if parallel.is_a?(Hash)
parallel || 1
end
end
end
---
name: ci_predefined_vars_in_builder
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72348
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/231300
milestone: '14.4'
type: development
group: group::pipeline authoring
default_enabled: false
......@@ -12,7 +12,7 @@ module Gitlab
def scoped_variables(job, environment:, dependencies:)
Gitlab::Ci::Variables::Collection.new.tap do |variables|
variables.concat(predefined_variables(job)) if pipeline.predefined_vars_in_builder_enabled?
variables.concat(predefined_variables(job))
end
end
......
......@@ -24,15 +24,5 @@ RSpec.describe Gitlab::Ci::Variables::Builder do
expect(names).to include(*keys)
end
end
context 'feature flag disabled' do
before do
stub_feature_flags(ci_predefined_vars_in_builder: false)
end
it 'returns no variables' do
expect(subject.map { |env| env[:key] }).to be_empty
end
end
end
end
......@@ -3421,10 +3421,6 @@ RSpec.describe Ci::Build do
end
describe '#scoped_variables' do
before do
pipeline.clear_memoization(:predefined_vars_in_builder_enabled)
end
it 'records a prometheus metric' do
histogram = double(:histogram)
expect(::Gitlab::Ci::Pipeline::Metrics).to receive(:pipeline_builder_scoped_variables_histogram)
......@@ -3522,22 +3518,6 @@ RSpec.describe Ci::Build do
build.scoped_variables
end
context 'when ci builder feature flag is disabled' do
before do
stub_feature_flags(ci_predefined_vars_in_builder: false)
end
it 'does not delegate to the variable builders' do
expect_next_instance_of(Gitlab::Ci::Variables::Builder) do |builder|
expect(builder).not_to receive(:predefined_variables)
end
build.scoped_variables
end
it_behaves_like 'calculates scoped_variables'
end
end
describe '#simple_variables_without_dependencies' 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