Commit f78b53e0 authored by Marius Bobin's avatar Marius Bobin

Remove feature flag for bulk inserting job tags

Changelog: other
parent e09a291d
---
name: ci_bulk_insert_tags
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73198
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/346124
milestone: '14.6'
type: development
group: group::pipeline execution
default_enabled: true
......@@ -14,7 +14,7 @@ module Gitlab
with_bulk_insert_tags do
pipeline.transaction do
pipeline.save!
CommitStatus.bulk_insert_tags!(statuses) if bulk_insert_tags?
CommitStatus.bulk_insert_tags!(statuses)
end
end
end
......@@ -29,15 +29,9 @@ module Gitlab
private
def bulk_insert_tags?
strong_memoize(:bulk_insert_tags) do
::Feature.enabled?(:ci_bulk_insert_tags, project, default_enabled: :yaml)
end
end
def with_bulk_insert_tags
previous = Thread.current['ci_bulk_insert_tags']
Thread.current['ci_bulk_insert_tags'] = bulk_insert_tags?
Thread.current['ci_bulk_insert_tags'] = true
yield
ensure
Thread.current['ci_bulk_insert_tags'] = previous
......
......@@ -106,21 +106,5 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Create do
expect(job.reload.tag_list).to match_array(%w[tag1 tag2])
end
end
context 'when the feature flag is disabled' do
before do
job.tag_list = %w[tag1 tag2]
stub_feature_flags(ci_bulk_insert_tags: false)
end
it 'follows the old code path' do
expect(CommitStatus).not_to receive(:bulk_insert_tags!)
step.perform!
expect(job).to be_persisted
expect(job.reload.tag_list).to match_array(%w[tag1 tag2])
end
end
end
end
......@@ -81,31 +81,6 @@ RSpec.describe Ci::CreatePipelineService do
end
end
context 'when the feature flag is disabled' do
before do
stub_feature_flags(ci_bulk_insert_tags: false)
end
it 'executes N+1s queries' do
stub_yaml_config(config_without_tags)
# warm up the cached objects so we get a more accurate count
create_pipeline
control = ActiveRecord::QueryRecorder.new(skip_cached: false) do
create_pipeline
end
stub_yaml_config(config)
expect { pipeline }
.to exceed_all_query_limit(control)
.with_threshold(4)
expect(pipeline).to be_created_successfully
end
end
context 'when tags are already persisted' do
it 'does not execute N+1 queries' do
# warm up the cached objects so we get a more accurate count
......
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