Skip to content

Replace entire RSpec.describe block and remove metadata

Terri Chu requested to merge 458961-remove-metadata-from-rspec-block into master

What does this MR do and why?

Related to #458961 (closed)

This MR updates the MarkOldAdvancedSearchMigrationsAsObsolete keep.

It replaces entire RSpec.describe block to remove all metadata (like :elastic, :elastic_clean, :sidekick_inline). The elastic tags will slow down specs because they start up and tear down an Elasticsearch cluster for specs. This is not needed for obsolete migrations.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

N/A

How to set up and validate locally

run this command to test locally

bundle exec gitlab-housekeeper --target-branch=master -k Keeps::MarkOldAdvancedSearchMigrationsAsObsolete -m 5 --dry-run
Click to expand for output
➜ bundle exec gitlab-housekeeper --target-branch=master -k Keeps::MarkOldAdvancedSearchMigrationsAsObsolete -m 5 --dry-run
Running keep Keeps::MarkOldAdvancedSearchMigrationsAsObsolete
Merge request URL: (known after create), on branch mark-old-advanced-search-migrations-as-obsolete-mark_obsolete-20230426195404--add-hidden-to-merge-requests. CI skipped.
=> MarkOldAdvancedSearchMigrationsAsObsolete: mark_obsolete: 20230426195404: AddHiddenToMergeRequests
=> Title:
Mark 20230426195404 as obsolete

=> Description:
This migration marks the 20230426195404 AddHiddenToMergeRequests Advanced search migration as obsolete.

This MR will still need changes to remove [references to the migration](https://gitlab.com/search?project_id=278964&scope=blobs&search=add_hidden_to_merge_requests&regex=false)
in the code. At the moment, the `gitlab-housekeeper` is not always capable of removing all references so
you must check the diff and pipeline failures to confirm if there are any issues.
It is the responsibility of the assignee (picked from ~"group::global search") to push those changes to this branch.

You can read more about the process for marking Advanced search migrations as obsolete in
https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#deleting-advanced-search-migrations-in-a-major-version-upgrade.

As part of our process we want to ensure all Advanced search migrations have had at least one
[required stop](https://docs.gitlab.com/ee/development/database/required_stops.html)
to process the migration. Therefore we can mark any Advanced search migrations added before the
last required stop as obsolete.


=> Attributes:
Labels: maintenance::refactor, group::global search, automation:gitlab-housekeeper-authored
Assignees: johnmason
Reviewers:

=> Diff:
diff --git a/ee/elastic/docs/20230426195404_add_hidden_to_merge_requests.yml b/ee/elastic/docs/20230426195404_add_hidden_to_merge_requests.yml
index 4dddf933f924..9cd2dd920dc7 100644
--- a/ee/elastic/docs/20230426195404_add_hidden_to_merge_requests.yml
+++ b/ee/elastic/docs/20230426195404_add_hidden_to_merge_requests.yml
@@ -5,6 +5,6 @@ description: AddHiddenToMergeRequests
 group: group::global search
 milestone: '16.0'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118842
-obsolete: false
+obsolete: true
 marked_obsolete_by_url:
-marked_obsolete_in_milestone:
+marked_obsolete_in_milestone: '17.1'
diff --git a/ee/elastic/migrate/20230426195404_add_hidden_to_merge_requests.rb b/ee/elastic/migrate/20230426195404_add_hidden_to_merge_requests.rb
index 729c11c3b008..0a86499e3ba0 100644
--- a/ee/elastic/migrate/20230426195404_add_hidden_to_merge_requests.rb
+++ b/ee/elastic/migrate/20230426195404_add_hidden_to_merge_requests.rb
@@ -15,3 +15,5 @@ def new_mappings
     }
   end
 end
+
+AddHiddenToMergeRequests.prepend ::Elastic::MigrationObsolete
diff --git a/ee/spec/elastic/migrate/20230426195404_add_hidden_to_merge_requests_spec.rb b/ee/spec/elastic/migrate/20230426195404_add_hidden_to_merge_requests_spec.rb
index e83b48d4fc57..91b207b99cc8 100644
--- a/ee/spec/elastic/migrate/20230426195404_add_hidden_to_merge_requests_spec.rb
+++ b/ee/spec/elastic/migrate/20230426195404_add_hidden_to_merge_requests_spec.rb
@@ -3,8 +3,6 @@
 require 'spec_helper'
 require File.expand_path('ee/elastic/migrate/20230426195404_add_hidden_to_merge_requests.rb')

-RSpec.describe AddHiddenToMergeRequests, :elastic, :sidekiq_inline, feature_category: :global_search do
-  let(:version) { 20230426195404 }
-
-  include_examples 'migration adds mapping'
+RSpec.describe AddHiddenToMergeRequests, feature_category: :global_search do
+  it_behaves_like 'a deprecated Advanced Search migration', 20230426195404
 end


Merge request URL: (known after create), on branch mark-old-advanced-search-migrations-as-obsolete-mark_obsolete-20230518064300--backfill-project-permissions-in-blobs. CI skipped.
=> MarkOldAdvancedSearchMigrationsAsObsolete: mark_obsolete: 20230518064300: BackfillProjectPermissionsInBlobs
=> Title:
Mark 20230518064300 as obsolete

=> Description:
This migration marks the 20230518064300 BackfillProjectPermissionsInBlobs Advanced search migration as obsolete.

This MR will still need changes to remove [references to the migration](https://gitlab.com/search?project_id=278964&scope=blobs&search=backfill_project_permissions_in_blobs&regex=false)
in the code. At the moment, the `gitlab-housekeeper` is not always capable of removing all references so
you must check the diff and pipeline failures to confirm if there are any issues.
It is the responsibility of the assignee (picked from ~"group::global search") to push those changes to this branch.

You can read more about the process for marking Advanced search migrations as obsolete in
https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#deleting-advanced-search-migrations-in-a-major-version-upgrade.

As part of our process we want to ensure all Advanced search migrations have had at least one
[required stop](https://docs.gitlab.com/ee/development/database/required_stops.html)
to process the migration. Therefore we can mark any Advanced search migrations added before the
last required stop as obsolete.


=> Attributes:
Labels: maintenance::refactor, group::global search, automation:gitlab-housekeeper-authored
Assignees: johnmason
Reviewers:

=> Diff:
diff --git a/ee/elastic/docs/20230518064300_backfill_project_permissions_in_blobs.yml b/ee/elastic/docs/20230518064300_backfill_project_permissions_in_blobs.yml
index e61da5a151ba..aa5315497aae 100644
--- a/ee/elastic/docs/20230518064300_backfill_project_permissions_in_blobs.yml
+++ b/ee/elastic/docs/20230518064300_backfill_project_permissions_in_blobs.yml
@@ -5,6 +5,6 @@ description: BackfillProjectPermissionsInBlobs
 group: group::global search
 milestone: '16.1'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121077
-obsolete: false
+obsolete: true
 marked_obsolete_by_url:
-marked_obsolete_in_milestone:
+marked_obsolete_in_milestone: '17.1'
diff --git a/ee/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs.rb b/ee/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs.rb
index 310a3ed1525d..951549531b60 100644
--- a/ee/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs.rb
+++ b/ee/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs.rb
@@ -189,3 +189,5 @@ def determine_project_limit
     [get_number_of_shards(index_name: helper.target_name), max_projects_to_process].min
   end
 end
+
+BackfillProjectPermissionsInBlobs.prepend ::Elastic::MigrationObsolete
diff --git a/ee/spec/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs_spec.rb b/ee/spec/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs_spec.rb
index b699565d0f2e..9926d59ef62d 100644
--- a/ee/spec/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs_spec.rb
+++ b/ee/spec/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs_spec.rb
@@ -3,228 +3,6 @@
 require 'spec_helper'
 require File.expand_path('ee/elastic/migrate/20230518064300_backfill_project_permissions_in_blobs.rb')

-RSpec.describe BackfillProjectPermissionsInBlobs, :elastic_clean, :sidekiq_inline,
-  feature_category: :global_search do
-    let(:version) { 20230518064300 }
-    let(:helper) { Gitlab::Elastic::Helper.new }
-    let(:migration) { described_class.new(version) }
-
-    let_it_be_with_reload(:projects) { create_list(:project, 3, :repository) }
-
-    before do
-      stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
-      set_elasticsearch_migration_to(version, including: false)
-
-      allow(migration).to receive(:helper).and_return(helper)
-    end
-
-    describe 'migration_options' do
-      it 'has migration options set', :aggregate_failures do
-        expect(migration).to be_batched
-        expect(migration).to be_retry_on_failure
-        expect(migration.throttle_delay).to eq(5.seconds)
-        expect(migration.batch_size).to eq(10_000)
-      end
-    end
-
-    describe '.migrate' do
-      context 'with project permissions in all projects' do
-        it 'does not execute update_by_query' do
-          projects = create_list(:project, 2, :repository)
-          projects.each { |p| p.repository.index_commits_and_blobs }
-
-          ensure_elasticsearch_index!
-
-          migration.migrate
-
-          expect(migration).to be_completed
-          expect(helper.client).not_to receive(:update_by_query)
-        end
-      end
-
-      context 'when task in progress' do
-        let(:project_in_progress) { Project.first }
-
-        before do
-          projects.each do |project|
-            project.repository.index_commits_and_blobs # ensure objects are indexed
-          end
-          ensure_elasticsearch_index!
-          projects.each { |project| remove_permissions_for_blob(project) }
-          allow(migration).to receive(:completed?).and_return(false)
-          allow(helper).to receive(:task_status).with(task_id: 'task_1').and_return('completed' => false)
-          migration.set_migration_state(
-            projects_in_progress: [{ task_id: 'task_1',
-                                     project_id: project_in_progress.id }], remaining_count: 3)
-        end
-
-        it 'does not send update_by_query to the project in progress' do
-          expect(migration).to receive(:update_by_query).with(Project.second).and_call_original
-          expect(migration).to receive(:update_by_query).with(Project.last).and_call_original
-          expect(migration).not_to receive(:update_by_query).with(project_in_progress)
-          migration.migrate
-        end
-      end
-
-      context 'with project not found exception' do
-        let(:client) { ::Gitlab::Search::Client.new }
-
-        before do
-          allow(migration).to receive(:client).and_return(client)
-          allow(migration).to receive(:projects_with_missing_project_permissions).and_return([0])
-          allow(migration).to receive(:completed?).and_return(false)
-        end
-
-        it 'schedules ElasticDeleteProjectWorker when project is not found' do
-          expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(0, "project_0")
-          migration.migrate
-        end
-      end
-
-      context 'when migration fails' do
-        let(:client) { ::Gitlab::Search::Client.new }
-
-        before do
-          allow(client).to receive(:update_by_query).and_return(update_by_query_response)
-          allow(helper).to receive(:task_status).with(task_id: 'task_1').and_return(task_status_response)
-
-          allow(migration).to receive(:projects_with_missing_project_permissions).and_return(projects.map(&:id))
-          allow(migration).to receive(:completed?).and_return(false)
-          allow(migration).to receive(:client).and_return(client)
-        end
-
-        context 'when Elasticsearch responds with errors' do
-          context 'when a task throws an error' do
-            let(:task_status_response) { { 'error' => ['failed'] } }
-            let(:update_by_query_response) { { 'task' => 'task_1' } }
-
-            it 'removes entry from projects_in_progress in migration_state' do
-              migration_state = projects.map { |p| { task_id: 'task_1', project_id: p.id } }
-              migration.set_migration_state(projects_in_progress: migration_state)
-              expect(migration).to receive(:set_migration_state).with(projects_in_progress: [], remaining_count: 0)
-              expect(migration).to receive(:set_migration_state).with(projects_in_progress: migration_state,
-                remaining_count: 0)
-
-              expect { migration.migrate }.not_to raise_error
-
-              expect(migration.migration_state[:projects_in_progress]).to match_array(migration_state)
-            end
-          end
-
-          context 'when update_by_query throws an error' do
-            let(:task_status_response) { {} }
-            let(:update_by_query_response) { { 'failures' => ['failed'] } }
-
-            it 'removes entry from projects_in_progress in migration_state' do
-              migration.set_migration_state({}) # simulate first run
-
-              expect { migration.migrate }.not_to raise_error
-              expect(migration.migration_state).to match({ projects_in_progress: [], remaining_count: 0 })
-            end
-          end
-        end
-      end
-    end
-
-    describe 'when Elasticsearch gives 404', :elastic_clean do
-      context 'when Elasticsearch responds with NotFoundException' do
-        let(:client) { ::Gitlab::Search::Client.new }
-        let(:update_by_query_response) { { 'failures' => ['failed'] } }
-
-        before do
-          allow(client).to receive(:update_by_query).and_return(update_by_query_response)
-
-          allow(migration).to receive(:projects_with_missing_project_permissions).and_return(projects.map(&:id))
-          allow(migration).to receive(:completed?).and_return(false)
-          allow(migration).to receive(:client).and_return(client)
-        end
-
-        context 'when a task_status throws a NotFound Exception' do
-          it 'removes entry from projects_in_progress in migration_state' do
-            migration_state = projects.map { |p| { task_id: 'oTUltX4IQMOUUVeiohTt8A:124', project_id: p.id } }
-            migration.set_migration_state(projects_in_progress: migration_state, remaining_count: 1)
-            expect(migration).to receive(:set_migration_state).with(projects_in_progress: [], remaining_count: 0).twice
-
-            expect { migration.migrate }.not_to raise_error
-
-            expect(migration.migration_state[:projects_in_progress]).to match_array(migration_state)
-          end
-        end
-      end
-    end
-
-    describe 'integration test', :elastic_clean do
-      before do
-        set_elasticsearch_migration_to(version, including: false)
-
-        projects.each do |project|
-          project.repository.index_commits_and_blobs # ensure objects are indexed
-        end
-        ensure_elasticsearch_index!
-        projects.each { |project| remove_permissions_for_blob(project) }
-        set_elasticsearch_migration_to(version, including: false)
-      end
-
-      it 'updates documents in batches' do
-        # calculate how many files are in each project in the index
-        query = { bool: { must: [{ term: { project_id: projects.first.id } }, { terms: { type: %w[blob] } }] } }
-        file_count = helper.client.count(index: helper.target_name, body: { query: query })['count']
-        allow(migration).to receive(:batch_size).and_return((file_count / 2.to_f).ceil)
-        allow(migration).to receive(:max_projects_to_process).and_return(2)
-        expect(migration).not_to be_completed
-        expect(migration).to receive(:update_by_query).exactly(6).times.and_call_original
-
-        expected_migration_project_ids = projects.pluck(:id)
-
-        migrate_batch_of_projects(migration)
-
-        counter = 0
-        while counter < 10 && migration.migration_state[:projects_in_progress].present?
-          actual_project_ids = migration.migration_state[:projects_in_progress].pluck(:project_id)
-          expect(expected_migration_project_ids).to include(*actual_project_ids)
-
-          migrate_batch_of_projects(migration)
-          counter += 1
-        end
-
-        expect(migration).to be_completed
-      end
-    end
-
-    def migrate_batch_of_projects(migration)
-      old_migration_state = migration.migration_state[:projects_in_progress]
-      10.times do |_| # Max 0.1s waiting
-        migration.migrate
-        break if old_migration_state != migration.migration_state[:projects_in_progress]
-
-        sleep 0.01
-      end
-    end
-
-    def remove_permissions_for_blob(project)
-      source = "ctx._source.remove('visibility_level');ctx._source.remove('repository_access_level')"
-      update_by_query project, source
-    end
-
-    def update_by_query(project, source)
-      Repository.__elasticsearch__.client.update_by_query({
-        index: Repository.__elasticsearch__.index_name,
-        wait_for_completion: true,
-        refresh: true,
-        body: {
-          query: {
-            bool: {
-              filter: [
-                { term: { project_id: project.id } },
-                { term: { type: 'blob' } }
-              ]
-            }
-          },
-          script: {
-            lang: "painless",
-            source: source
-          }
-        }
-      })
-    end
-  end
+RSpec.describe BackfillProjectPermissionsInBlobs, feature_category: :global_search do
+  it_behaves_like 'a deprecated Advanced Search migration', 20230518064300
+end


Merge request URL: (known after create), on branch mark-old-advanced-search-migrations-as-obsolete-mark_obsolete-20230615101400--create-epic-index. CI skipped.
=> MarkOldAdvancedSearchMigrationsAsObsolete: mark_obsolete: 20230615101400: CreateEpicIndex
=> Title:
Mark 20230615101400 as obsolete

=> Description:
This migration marks the 20230615101400 CreateEpicIndex Advanced search migration as obsolete.

This MR will still need changes to remove [references to the migration](https://gitlab.com/search?project_id=278964&scope=blobs&search=create_epic_index&regex=false)
in the code. At the moment, the `gitlab-housekeeper` is not always capable of removing all references so
you must check the diff and pipeline failures to confirm if there are any issues.
It is the responsibility of the assignee (picked from ~"group::global search") to push those changes to this branch.

You can read more about the process for marking Advanced search migrations as obsolete in
https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#deleting-advanced-search-migrations-in-a-major-version-upgrade.

As part of our process we want to ensure all Advanced search migrations have had at least one
[required stop](https://docs.gitlab.com/ee/development/database/required_stops.html)
to process the migration. Therefore we can mark any Advanced search migrations added before the
last required stop as obsolete.


=> Attributes:
Labels: maintenance::refactor, group::global search, automation:gitlab-housekeeper-authored
Assignees: maddievn
Reviewers:

=> Diff:
diff --git a/ee/elastic/docs/20230615101400_create_epic_index.yml b/ee/elastic/docs/20230615101400_create_epic_index.yml
index 1b400d141f8f..7ad66396a0b7 100644
--- a/ee/elastic/docs/20230615101400_create_epic_index.yml
+++ b/ee/elastic/docs/20230615101400_create_epic_index.yml
@@ -5,6 +5,6 @@ description: Create a standalone index for Epics
 group: group::global search
 milestone: '16.2'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121635
-obsolete: false
+obsolete: true
 marked_obsolete_by_url:
-marked_obsolete_in_milestone:
+marked_obsolete_in_milestone: '17.1'
diff --git a/ee/elastic/migrate/20230615101400_create_epic_index.rb b/ee/elastic/migrate/20230615101400_create_epic_index.rb
index 9dd9d3cadf3b..cccf169f0c4a 100644
--- a/ee/elastic/migrate/20230615101400_create_epic_index.rb
+++ b/ee/elastic/migrate/20230615101400_create_epic_index.rb
@@ -13,3 +13,5 @@ def target_class
     Epic
   end
 end
+
+CreateEpicIndex.prepend ::Elastic::MigrationObsolete
diff --git a/ee/spec/elastic/migrate/20230615101400_create_epic_index_spec.rb b/ee/spec/elastic/migrate/20230615101400_create_epic_index_spec.rb
index 07d5af0d6729..4259b9267da1 100644
--- a/ee/spec/elastic/migrate/20230615101400_create_epic_index_spec.rb
+++ b/ee/spec/elastic/migrate/20230615101400_create_epic_index_spec.rb
@@ -4,5 +4,5 @@
 require File.expand_path('ee/elastic/migrate/20230615101400_create_epic_index.rb')

 RSpec.describe CreateEpicIndex, feature_category: :global_search do
-  it_behaves_like 'migration creates a new index', 20230615101400, Epic
+  it_behaves_like 'a deprecated Advanced Search migration', 20230615101400
 end


Merge request URL: (known after create), on branch mark-old-advanced-search-migrations-as-obsolete-mark_obsolete-20230628094243--add-archived-to-issues. CI skipped.
=> MarkOldAdvancedSearchMigrationsAsObsolete: mark_obsolete: 20230628094243: AddArchivedToIssues
=> Title:
Mark 20230628094243 as obsolete

=> Description:
This migration marks the 20230628094243 AddArchivedToIssues Advanced search migration as obsolete.

This MR will still need changes to remove [references to the migration](https://gitlab.com/search?project_id=278964&scope=blobs&search=add_archived_to_issues&regex=false)
in the code. At the moment, the `gitlab-housekeeper` is not always capable of removing all references so
you must check the diff and pipeline failures to confirm if there are any issues.
It is the responsibility of the assignee (picked from ~"group::global search") to push those changes to this branch.

You can read more about the process for marking Advanced search migrations as obsolete in
https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#deleting-advanced-search-migrations-in-a-major-version-upgrade.

As part of our process we want to ensure all Advanced search migrations have had at least one
[required stop](https://docs.gitlab.com/ee/development/database/required_stops.html)
to process the migration. Therefore we can mark any Advanced search migrations added before the
last required stop as obsolete.


=> Attributes:
Labels: maintenance::refactor, group::global search, automation:gitlab-housekeeper-authored
Assignees: maddievn
Reviewers:

=> Diff:
diff --git a/ee/elastic/docs/20230628094243_add_archived_to_issues.yml b/ee/elastic/docs/20230628094243_add_archived_to_issues.yml
index df90eba7a942..ec88c004dd58 100644
--- a/ee/elastic/docs/20230628094243_add_archived_to_issues.yml
+++ b/ee/elastic/docs/20230628094243_add_archived_to_issues.yml
@@ -5,6 +5,6 @@ description: AddArchivedToIssues
 group: group::global search
 milestone: '16.2'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124846
-obsolete: false
+obsolete: true
 marked_obsolete_by_url:
-marked_obsolete_in_milestone:
+marked_obsolete_in_milestone: '17.1'
diff --git a/ee/elastic/migrate/20230628094243_add_archived_to_issues.rb b/ee/elastic/migrate/20230628094243_add_archived_to_issues.rb
index 1f339c6858e7..ee2911eda180 100644
--- a/ee/elastic/migrate/20230628094243_add_archived_to_issues.rb
+++ b/ee/elastic/migrate/20230628094243_add_archived_to_issues.rb
@@ -15,3 +15,5 @@ def new_mappings
     }
   end
 end
+
+AddArchivedToIssues.prepend ::Elastic::MigrationObsolete
diff --git a/ee/spec/elastic/migrate/20230628094243_add_archived_to_issues_spec.rb b/ee/spec/elastic/migrate/20230628094243_add_archived_to_issues_spec.rb
index 7e25f52e9329..6616771c7156 100644
--- a/ee/spec/elastic/migrate/20230628094243_add_archived_to_issues_spec.rb
+++ b/ee/spec/elastic/migrate/20230628094243_add_archived_to_issues_spec.rb
@@ -3,8 +3,6 @@
 require 'spec_helper'
 require File.expand_path('ee/elastic/migrate/20230628094243_add_archived_to_issues.rb')

-RSpec.describe AddArchivedToIssues, :elastic, :sidekiq_inline, feature_category: :global_search do
-  let(:version) { 20230628094243 }
-
-  include_examples 'migration adds mapping'
+RSpec.describe AddArchivedToIssues, feature_category: :global_search do
+  it_behaves_like 'a deprecated Advanced Search migration', 20230628094243
 end


Merge request URL: (known after create), on branch mark-old-advanced-search-migrations-as-obsolete-mark_obsolete-20230628094700--backfill-archived-on-issues. CI skipped.
=> MarkOldAdvancedSearchMigrationsAsObsolete: mark_obsolete: 20230628094700: BackfillArchivedOnIssues
=> Title:
Mark 20230628094700 as obsolete

=> Description:
This migration marks the 20230628094700 BackfillArchivedOnIssues Advanced search migration as obsolete.

This MR will still need changes to remove [references to the migration](https://gitlab.com/search?project_id=278964&scope=blobs&search=backfill_archived_on_issues&regex=false)
in the code. At the moment, the `gitlab-housekeeper` is not always capable of removing all references so
you must check the diff and pipeline failures to confirm if there are any issues.
It is the responsibility of the assignee (picked from ~"group::global search") to push those changes to this branch.

You can read more about the process for marking Advanced search migrations as obsolete in
https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#deleting-advanced-search-migrations-in-a-major-version-upgrade.

As part of our process we want to ensure all Advanced search migrations have had at least one
[required stop](https://docs.gitlab.com/ee/development/database/required_stops.html)
to process the migration. Therefore we can mark any Advanced search migrations added before the
last required stop as obsolete.


=> Attributes:
Labels: maintenance::refactor, group::global search, automation:gitlab-housekeeper-authored
Assignees: sdungarwal
Reviewers:

=> Diff:
diff --git a/ee/elastic/docs/20230628094700_backfill_archived_on_issues.yml b/ee/elastic/docs/20230628094700_backfill_archived_on_issues.yml
index c64d7269b08c..ae916b9f363a 100644
--- a/ee/elastic/docs/20230628094700_backfill_archived_on_issues.yml
+++ b/ee/elastic/docs/20230628094700_backfill_archived_on_issues.yml
@@ -5,6 +5,6 @@ description: BackfillArchivedOnIssues
 group: group::global search
 milestone: '16.2'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124846
-obsolete: false
+obsolete: true
 marked_obsolete_by_url:
-marked_obsolete_in_milestone:
+marked_obsolete_in_milestone: '17.1'
diff --git a/ee/elastic/migrate/20230628094700_backfill_archived_on_issues.rb b/ee/elastic/migrate/20230628094700_backfill_archived_on_issues.rb
index deffa770dff8..4889aad5b1a4 100644
--- a/ee/elastic/migrate/20230628094700_backfill_archived_on_issues.rb
+++ b/ee/elastic/migrate/20230628094700_backfill_archived_on_issues.rb
@@ -16,3 +16,5 @@ def field_name
     'archived'
   end
 end
+
+BackfillArchivedOnIssues.prepend ::Elastic::MigrationObsolete
diff --git a/ee/spec/elastic/migrate/20230628094700_backfill_archived_on_issues_spec.rb b/ee/spec/elastic/migrate/20230628094700_backfill_archived_on_issues_spec.rb
index afcb45e120ce..a3c8ba05e9e3 100644
--- a/ee/spec/elastic/migrate/20230628094700_backfill_archived_on_issues_spec.rb
+++ b/ee/spec/elastic/migrate/20230628094700_backfill_archived_on_issues_spec.rb
@@ -3,20 +3,6 @@
 require 'spec_helper'
 require File.expand_path('ee/elastic/migrate/20230628094700_backfill_archived_on_issues.rb')

-RSpec.describe BackfillArchivedOnIssues, :elastic_delete_by_query, :sidekiq_inline, feature_category: :global_search do
-  let(:version) { 20230628094700 }
-
-  include_examples 'migration backfills fields' do
-    let_it_be(:project) { create(:project, archived: true) }
-    let(:objects) { create_list(:issue, 3, project: project) }
-    let(:namespace) { project.namespace }
-    let(:expected_fields) do
-      {
-        archived: project.archived?
-      }
-    end
-
-    let(:expected_throttle_delay) { 1.minute }
-    let(:expected_batch_size) { 9000 }
-  end
+RSpec.describe BackfillArchivedOnIssues, feature_category: :global_search do
+  it_behaves_like 'a deprecated Advanced Search migration', 20230628094700
 end


Dry run complete. Housekeeper would have created 5 MRs on an actual run.
Edited by Terri Chu

Merge request reports