diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 390675ab80b6aa63daddb80ee7f7ec49d76fac4a..8a0148d9fafec60d687c339b4f5ddc563f15050a 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -161,7 +161,7 @@ def build_logger pipeline_includes_count = observations['pipeline_includes_count'] next false unless pipeline_includes_count - pipeline_includes_count.to_i > Gitlab::Ci::Config::External::Context::MAX_INCLUDES + pipeline_includes_count.to_i > Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES end end end diff --git a/config/feature_flags/development/ci_includes_count_duplicates.yml b/config/feature_flags/development/ci_includes_count_duplicates.yml deleted file mode 100644 index 5e33edddc03a9f79c0e2cbbbb4a3155d29d43008..0000000000000000000000000000000000000000 --- a/config/feature_flags/development/ci_includes_count_duplicates.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: ci_includes_count_duplicates -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111726 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/391517 -milestone: '15.9' -type: development -group: group::pipeline authoring -default_enabled: false diff --git a/lib/gitlab/ci/config/external/context.rb b/lib/gitlab/ci/config/external/context.rb index ab0477e4d44f0063f23d6d5ede2142438ca53dca..881b131c25209f89bec5758d5a98b4e5373a16f7 100644 --- a/lib/gitlab/ci/config/external/context.rb +++ b/lib/gitlab/ci/config/external/context.rb @@ -9,8 +9,8 @@ class Context TimeoutError = Class.new(StandardError) - MAX_INCLUDES = 100 - NEW_MAX_INCLUDES = 150 # Update to MAX_INCLUDES when FF ci_includes_count_duplicates is removed + MAX_INCLUDES = 150 + TEMP_MAX_INCLUDES = 100 # For logging; to be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/367150 include ::Gitlab::Utils::StrongMemoize @@ -29,10 +29,10 @@ def initialize( @parent_pipeline = parent_pipeline @variables = variables || Ci::Variables::Collection.new @pipeline_config = pipeline_config - @expandset = Feature.enabled?(:ci_includes_count_duplicates, project) ? [] : Set.new + @expandset = [] @execution_deadline = 0 @logger = logger || Gitlab::Ci::Pipeline::Logger.new(project: project) - @max_includes = Feature.enabled?(:ci_includes_count_duplicates, project) ? NEW_MAX_INCLUDES : MAX_INCLUDES + @max_includes = MAX_INCLUDES yield self if block_given? end diff --git a/lib/gitlab/ci/config/external/mapper/verifier.rb b/lib/gitlab/ci/config/external/mapper/verifier.rb index 2982b0efb6c1f3ba2c670e6a398a7e02cfb8dfa8..36cf091a532625e059265955c2ccf29dc13da9c9 100644 --- a/lib/gitlab/ci/config/external/mapper/verifier.rb +++ b/lib/gitlab/ci/config/external/mapper/verifier.rb @@ -28,11 +28,7 @@ def process_without_instrumentation(files) file.validate_content! if file.valid? file.load_and_validate_expanded_hash! if file.valid? - if context.expandset.is_a?(Array) # To be removed when FF 'ci_includes_count_duplicates' is removed - context.expandset << file - else - context.expandset.add(file) - end + context.expandset << file end end diff --git a/spec/lib/gitlab/ci/config/external/context_spec.rb b/spec/lib/gitlab/ci/config/external/context_spec.rb index bae898e13ebdfb37a74b2027f62d2b03566afca0..f1640822c6bce079ac00aca50cd173c497544831 100644 --- a/spec/lib/gitlab/ci/config/external/context_spec.rb +++ b/spec/lib/gitlab/ci/config/external/context_spec.rb @@ -15,7 +15,7 @@ context 'with values' do it { is_expected.to have_attributes(**attributes) } it { expect(subject.expandset).to eq([]) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::NEW_MAX_INCLUDES) } + it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } it { expect(subject.execution_deadline).to eq(0) } it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } @@ -27,38 +27,11 @@ it { is_expected.to have_attributes(**attributes) } it { expect(subject.expandset).to eq([]) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::NEW_MAX_INCLUDES) } + it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } it { expect(subject.execution_deadline).to eq(0) } it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } end - - context 'when FF ci_includes_count_duplicates is disabled' do - before do - stub_feature_flags(ci_includes_count_duplicates: false) - end - - context 'with values' do - it { is_expected.to have_attributes(**attributes) } - it { expect(subject.expandset).to eq(Set.new) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } - it { expect(subject.execution_deadline).to eq(0) } - it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } - it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } - it { expect(subject.variables_hash).to include('a' => 'b') } - end - - context 'without values' do - let(:attributes) { { project: nil, user: nil, sha: nil } } - - it { is_expected.to have_attributes(**attributes) } - it { expect(subject.expandset).to eq(Set.new) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } - it { expect(subject.execution_deadline).to eq(0) } - it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } - it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } - end - end end describe '#set_deadline' do diff --git a/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb b/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb index 2930a05a8a2bab79458b936ddab23b41bf1c03d3..b4576fb7a1d4369184c83b1f8388f9cbbfb68274 100644 --- a/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb @@ -191,17 +191,6 @@ allow(context).to receive(:max_includes).and_return(2) expect { process }.to raise_error(Gitlab::Ci::Config::External::Mapper::TooManyIncludesError) end - - context 'when FF ci_includes_count_duplicates is disabled' do - before do - stub_feature_flags(ci_includes_count_duplicates: false) - end - - it 'does not raise error' do - allow(context).to receive(:max_includes).and_return(2) - expect { process }.not_to raise_error - end - end end end end diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb index a731d0ddba343c9658ebbc3b5e8a56e0a67cad29..56d1ddee4b890b9fa6ed6636410d04a5faf62e0c 100644 --- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb @@ -234,17 +234,6 @@ process expect(context.expandset.size).to eq(2) end - - context 'when FF ci_includes_count_duplicates is disabled' do - before do - stub_feature_flags(ci_includes_count_duplicates: false) - end - - it 'has expanset with one' do - process - expect(context.expandset.size).to eq(1) - end - end end context 'when passing max number of files' do diff --git a/spec/services/ci/create_pipeline_service/logger_spec.rb b/spec/services/ci/create_pipeline_service/logger_spec.rb index ecb24a610752f25212fc943e14921418b885fb74..082a09db69e65cf727d0fda70af2e4338f8fff2f 100644 --- a/spec/services/ci/create_pipeline_service/logger_spec.rb +++ b/spec/services/ci/create_pipeline_service/logger_spec.rb @@ -142,7 +142,7 @@ describe 'pipeline includes count' do before do - stub_const('Gitlab::Ci::Config::External::Context::MAX_INCLUDES', 2) + stub_const('Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES', 2) end context 'when the includes count exceeds the maximum' do