Commit fe8c8d70 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'georgekoltsov/skip-members-relation-export' into 'master'

Do not export certain models when using Relations Export API

See merge request gitlab-org/gitlab!65347
parents 9acf8cbe 7c5cef46
...@@ -30,7 +30,7 @@ module BulkImports ...@@ -30,7 +30,7 @@ module BulkImports
end end
def portable_relations def portable_relations
import_export_config.dig(:tree, portable_class_sym).keys.map(&:to_s) import_export_config.dig(:tree, portable_class_sym).keys.map(&:to_s) - skipped_relations
end end
private private
...@@ -66,6 +66,10 @@ module BulkImports ...@@ -66,6 +66,10 @@ module BulkImports
def base_export_path def base_export_path
raise NotImplementedError raise NotImplementedError
end end
def skipped_relations
[]
end
end end
end end
end end
...@@ -10,6 +10,10 @@ module BulkImports ...@@ -10,6 +10,10 @@ module BulkImports
def import_export_yaml def import_export_yaml
::Gitlab::ImportExport.group_config_file ::Gitlab::ImportExport.group_config_file
end end
def skipped_relations
@skipped_relations ||= %w(members)
end
end end
end end
end end
...@@ -10,6 +10,10 @@ module BulkImports ...@@ -10,6 +10,10 @@ module BulkImports
def import_export_yaml def import_export_yaml
::Gitlab::ImportExport.config_file ::Gitlab::ImportExport.config_file
end end
def skipped_relations
@skipped_relations ||= %w(project_members group_members)
end
end end
end end
end end
...@@ -34,6 +34,10 @@ RSpec.describe BulkImports::FileTransfer::GroupConfig do ...@@ -34,6 +34,10 @@ RSpec.describe BulkImports::FileTransfer::GroupConfig do
it 'returns a list of top level exportable relations' do it 'returns a list of top level exportable relations' do
expect(subject.portable_relations).to include('milestones', 'badges', 'boards', 'labels') expect(subject.portable_relations).to include('milestones', 'badges', 'boards', 'labels')
end end
it 'does not include skipped relations' do
expect(subject.portable_relations).not_to include('members')
end
end end
describe '#top_relation_tree' do describe '#top_relation_tree' do
......
...@@ -34,6 +34,10 @@ RSpec.describe BulkImports::FileTransfer::ProjectConfig do ...@@ -34,6 +34,10 @@ RSpec.describe BulkImports::FileTransfer::ProjectConfig do
it 'returns a list of top level exportable relations' do it 'returns a list of top level exportable relations' do
expect(subject.portable_relations).to include('issues', 'labels', 'milestones', 'merge_requests') expect(subject.portable_relations).to include('issues', 'labels', 'milestones', 'merge_requests')
end end
it 'does not include skipped relations' do
expect(subject.portable_relations).not_to include('project_members', 'group_members')
end
end end
describe '#top_relation_tree' do describe '#top_relation_tree' do
......
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