From cc87297ec4560f49acc0db40bb00b57af62cc2e3 Mon Sep 17 00:00:00 2001 From: Terri Chu <tchu@gitlab.com> Date: Mon, 22 Jul 2024 18:50:29 +0000 Subject: [PATCH] Mark 20230719211400 as obsolete This migration marks the 20230719211400 AddArchivedToWikis Advanced search migration as obsolete. [Search for references to `add_archived_to_wikis` in code](https://gitlab.com/search?project_id=278964&scope=blobs&search=add_archived_to_wikis®ex=false)) 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. [Read more](https://docs.gitlab.com/ee/development/search/advanced_search_migration_styleguide.html#deleting-advanced-search-migrations-in-a-major-version-upgrade) about the process for marking Advanced search migrations as obsolete. All Advanced search migrations must have had at least one [required stop](https : // docs.gitlab.com / ee / development / database / required_stops.html) to process the migration. Therefore we mark any Advanced search migrations added before the last required stop as obsolete. This change was generated by [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper) using the Keeps::MarkOldAdvancedSearchMigrationsAsObsolete keep. To provide feedback on your experience with `gitlab-housekeeper` please create an issue with the label ~"GitLab Housekeeper" and consider pinging the author of this keep. Changelog: other EE: true --- .../20230719211400_add_archived_to_wikis.yml | 6 +-- .../20230719211400_add_archived_to_wikis.rb | 2 + ee/lib/gitlab/elastic/indexer.rb | 2 +- ...230719211400_add_archived_to_wikis_spec.rb | 6 +-- ee/spec/lib/gitlab/elastic/indexer_spec.rb | 40 ------------------- 5 files changed, 8 insertions(+), 48 deletions(-) diff --git a/ee/elastic/docs/20230719211400_add_archived_to_wikis.yml b/ee/elastic/docs/20230719211400_add_archived_to_wikis.yml index efe2676fece36..2e5b8d9a30a8c 100644 --- a/ee/elastic/docs/20230719211400_add_archived_to_wikis.yml +++ b/ee/elastic/docs/20230719211400_add_archived_to_wikis.yml @@ -5,6 +5,6 @@ description: Adds the boolean archived field on wikis index group: group::global search milestone: '16.3' introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126157 -obsolete: false -marked_obsolete_by_url: -marked_obsolete_in_milestone: +obsolete: true +marked_obsolete_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/159448 +marked_obsolete_in_milestone: '17.3' diff --git a/ee/elastic/migrate/20230719211400_add_archived_to_wikis.rb b/ee/elastic/migrate/20230719211400_add_archived_to_wikis.rb index 4b576100cfd95..3b96ed542ae04 100644 --- a/ee/elastic/migrate/20230719211400_add_archived_to_wikis.rb +++ b/ee/elastic/migrate/20230719211400_add_archived_to_wikis.rb @@ -13,3 +13,5 @@ def new_mappings { archived: { type: 'boolean' } } end end + +AddArchivedToWikis.prepend ::Elastic::MigrationObsolete diff --git a/ee/lib/gitlab/elastic/indexer.rb b/ee/lib/gitlab/elastic/indexer.rb index 1837d0bc8fc00..070744479576f 100644 --- a/ee/lib/gitlab/elastic/indexer.rb +++ b/ee/lib/gitlab/elastic/indexer.rb @@ -186,7 +186,7 @@ def build_command(base_sha, to_sha) def build_wiki_specific_flags %W[--blob-type=wiki_blob --skip-commits --wiki-access-level=#{container.wiki_access_level}].tap do |c| - c << "--archived=#{project.archived}" if project && migration_finished?(:add_archived_to_wikis) + c << "--archived=#{project.archived}" if project c << "--schema-version-wiki=#{WIKI_SCHEMA_VERSION}" end end diff --git a/ee/spec/elastic/migrate/20230719211400_add_archived_to_wikis_spec.rb b/ee/spec/elastic/migrate/20230719211400_add_archived_to_wikis_spec.rb index 90802f08c5bef..398d9f28e8cad 100644 --- a/ee/spec/elastic/migrate/20230719211400_add_archived_to_wikis_spec.rb +++ b/ee/spec/elastic/migrate/20230719211400_add_archived_to_wikis_spec.rb @@ -3,8 +3,6 @@ require 'spec_helper' require File.expand_path('ee/elastic/migrate/20230719211400_add_archived_to_wikis.rb') -RSpec.describe AddArchivedToWikis, :elastic, :sidekiq_inline, feature_category: :global_search do - let(:version) { 20230719211400 } - - include_examples 'migration adds mapping' +RSpec.describe AddArchivedToWikis, feature_category: :global_search do + it_behaves_like 'a deprecated Advanced Search migration', 20230719211400 end diff --git a/ee/spec/lib/gitlab/elastic/indexer_spec.rb b/ee/spec/lib/gitlab/elastic/indexer_spec.rb index 86c31b3cf30f4..5280051b944a7 100644 --- a/ee/spec/lib/gitlab/elastic/indexer_spec.rb +++ b/ee/spec/lib/gitlab/elastic/indexer_spec.rb @@ -405,46 +405,6 @@ def indexed_commits_for(term) expect(indexed_wiki_paths_for('23')).not_to include('23.md') end end - - context 'when add_archived_to_wikis migration is not completed' do - before do - set_elasticsearch_migration_to(:add_archived_to_wikis, including: false) - end - - it 'runs the indexer without --archived flag' do - gitaly_connection_data = { - storage: project.repository_storage, - limit_file_size: Gitlab::CurrentSettings.elasticsearch_indexed_file_size_limit_kb.kilobytes - }.merge(Gitlab::GitalyClient.connection_data(project.repository_storage)) - expect_popen.with( - [ - TestEnv.indexer_bin_path, - "--timeout=#{described_class::TIMEOUT}s", - "--visibility-level=#{project.visibility_level}", - "--project-id=#{project.id}", - '--search-curation', - "--from-sha=#{expected_from_sha}", - "--to-sha=#{to_sha}", - "--full-path=#{project.full_path}", - '--blob-type=wiki_blob', - '--skip-commits', - "--wiki-access-level=#{project.wiki_access_level}", - "--schema-version-wiki=#{described_class::WIKI_SCHEMA_VERSION}", - "--traversal-ids=#{project.namespace_ancestry}", - "#{project.wiki.repository.disk_path}.git" - ], - nil, - hash_including( - 'GITALY_CONNECTION_INFO' => gitaly_connection_data.to_json, - 'ELASTIC_CONNECTION_INFO' => elasticsearch_config.to_json, - 'RAILS_ENV' => Rails.env, - 'CORRELATION_ID' => Labkit::Correlation::CorrelationId.current_id - ) - ).and_return(popen_success) - - indexer.run - end - end end end -- GitLab