Skip to content
Snippets Groups Projects
Unverified Commit 0a3226a6 authored by Terri Chu's avatar Terri Chu Committed by GitLab
Browse files

Mark 20240208160152 as obsolete

This migration marks the 20240208160152 AddCountFieldsToProjects Advanced search migration as obsolete.

[Search for references to `add_count_fields_to_projects` in code](https://gitlab.com/search?project_id=278964&scope=blobs&search=add_count_fields_to_projects&regex=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#cleaning-up-advanced-search-migrations)
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
parent a6b38bb5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,6 +5,6 @@ description: Add star_count and last_repository_updated_date to projects index.
group: group::global search
milestone: '16.10'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144557
obsolete: false
marked_obsolete_by_url:
marked_obsolete_in_milestone:
obsolete: true
marked_obsolete_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169309
marked_obsolete_in_milestone: '17.6'
Loading
Loading
@@ -18,3 +18,5 @@ def new_mappings
}
end
end
AddCountFieldsToProjects.prepend ::Elastic::MigrationObsolete
Loading
Loading
@@ -32,7 +32,8 @@ def as_indexed_json(_options = {})
:visibility_level,
:last_activity_at,
:name_with_namespace,
:path_with_namespace
:path_with_namespace,
:star_count
].each do |attr|
data[attr.to_s] = safely_read_attribute_for_elasticsearch(attr)
end
Loading
Loading
@@ -48,6 +49,8 @@ def as_indexed_json(_options = {})
 
data['ci_catalog'] = target.catalog_resource.present?
 
data['last_repository_updated_date'] = target.last_repository_updated_at
if ::Elastic::DataMigrationService.migration_has_finished?(:add_fields_to_projects_index)
data['mirror'] = target.mirror?
data['forked'] = target.forked? || false
Loading
Loading
@@ -55,8 +58,6 @@ def as_indexed_json(_options = {})
data['repository_languages'] = target.repository_languages.map(&:name)
end
 
data.merge!(add_count_fields(target))
data
end
 
Loading
Loading
@@ -64,18 +65,6 @@ def as_indexed_json(_options = {})
def es_parent
"n_#{target.root_ancestor.id}"
end
private
def add_count_fields(target)
data = {}
if ::Elastic::DataMigrationService.migration_has_finished?(:add_count_fields_to_projects)
data['star_count'] = target.star_count
data['last_repository_updated_date'] = target.last_repository_updated_at
end
data
end
end
end
end
Loading
Loading
@@ -3,8 +3,6 @@
require 'spec_helper'
require File.expand_path('ee/elastic/migrate/20240208160152_add_count_fields_to_projects.rb')
 
RSpec.describe AddCountFieldsToProjects, :elastic, feature_category: :global_search do
let(:version) { 20240208160152 }
include_examples 'migration adds mapping'
RSpec.describe AddCountFieldsToProjects, feature_category: :global_search do
it_behaves_like 'a deprecated Advanced Search migration', 20240208160152
end
Loading
Loading
@@ -72,19 +72,6 @@
expect(result.keys).not_to include(:repository_languages)
end
end
context 'when add_count_fields_to_projects migration is not completed' do
before do
set_elasticsearch_migration_to(:add_count_fields_to_projects, including: false)
end
it 'does not include the gated fields' do
result = proxy.as_indexed_json.with_indifferent_access
expect(result.keys).not_to include(:star_count)
expect(result.keys).not_to include(:last_repository_updated_date)
end
end
end
 
describe '#es_parent' do
Loading
Loading
Loading
Loading
@@ -211,19 +211,6 @@
expect(project.__elasticsearch__.as_indexed_json).to eq(expected_hash)
end
 
context 'when add_count_fields_to_projects is not finished' do
before do
set_elasticsearch_migration_to(:add_count_fields_to_projects, including: false)
end
it 'does not include the ci_catalog field' do
as_indexed_json = project.__elasticsearch__.as_indexed_json
expect(as_indexed_json).not_to have_key('star_count')
expect(as_indexed_json).not_to have_key('last_repository_updated_date')
end
end
context 'when add_fields_to_projects_index is not finished' do
before do
set_elasticsearch_migration_to(:add_fields_to_projects_index, including: false)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment