Skip to content

Group Structure Import

George Koltsov requested to merge georgekoltsov/group-structure-import into master

What does this MR do?

This MR introduces Group Structure Import functionality, which is similar to Project Import/Export.

Given Group Export archive from !18938 (merged) it is going to import:

  • Root group with all it's children (sub groups)
  • Epics (Parent epics are links correctly, cross group)
  • Milestones
  • Labels
  • Boards
  • Badges
  • Assign Group Members (if users exist on the new destination instance)

What is not being exported / imported

  • Board - milestone relation. Due to the fact that there are default predefined milestones Milestone::MilestoneStruct which do not have the same interface as the regular Milestones, which on Import makes it fail due to undefined method errors
  • Boards do not have lists. This is something I need to investigate further. Import of milestone lists fails due to this validation http://gitlab.com/gitlab-org/gitlab/blob/georgekoltsov/group-structure-import/ee/app/models/ee/list.rb#L28-28 which shouldn't (since my group has this feature)
  • Similarly to Project I/E, group members will only be linked to existing users. No users are created during this process.

Steps to reproduce

  1. Create a test group with sub groups and relations. https://gitlab.com/snippets/1913239 can be used in rails console to automatically do that for you
  2. rails c
group_id = <ROOT_GROUP_ID>
user_id = 1

# Export
GroupExportWorker.new.perform(user_id, group_id)
filepath = Group.find(group_id).import_export_upload.export_file.file.file

# Import
name = FFaker::Lorem.characters(50)

params = {
  name:                 name,
  path:                 name,
  import_export_upload: ImportExportUpload.new(import_file: File.open(filepath))
}

group = ::Groups::CreateService.new(User.find(user_id), params).execute

GroupImportWorker.new.perform(user_id, group.id)

Issue: #32932 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports