Skip to content

Group Export relations with subgroups

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

What does this MR do?

This MR introduces Group Structure Export mechanism. This MR does not expose any ways of triggering this mechanism yet (addition of API endpoint to follow).

Group Export only covers relations specified in group_import_export.yml. It does not include project exports. Only group relations, and subgroups (as descendants) done recursively.

Steps to reproduce

  1. Start sidekiq
rails c

[4] pry(main)> GroupExportWorker.perform_async(1, 8)
=> "b4adc4db71a03f107d74c2e7"
  1. Verify sidekiq GroupExportWorker started and finished
[6] pry(main)> Group.find(8).import_export_upload.export_file
  Group Load (0.7ms)  SELECT  "namespaces".* FROM "namespaces" WHERE "namespaces"."type" IN ('Group') AND "namespaces"."id" = $1 LIMIT $2  [["id", 8], ["LIMIT", 1]]
  ImportExportUpload Load (0.2ms)  SELECT  "import_export_uploads".* FROM "import_export_uploads" WHERE "import_export_uploads"."group_id" = $1 LIMIT $2  [["group_id", 8], ["LIMIT", 1]]
  Upload Load (0.7ms)  SELECT  "uploads".* FROM "uploads" WHERE "uploads"."model_type" = $1 AND "uploads"."model_id" = $2 AND "uploads"."path" IN ($3, $4) LIMIT $5  [["model_type", "ImportExportUpload"], ["model_id", 1], ["path", "uploads/-/system/import_export_upload/export_file/1/2019-11-05_13-20-080_h5bp_export.tar.gz"], ["path", "import_export_upload/export_file/1/2019-11-05_13-20-080_h5bp_export.tar.gz"], ["LIMIT", 1]]
=> #<ImportExportUploader:0x00007f9233189cd8
  1. Check group.json in the archive -- verify information is exported, relations are included, subgroups are included.

Does this MR meet the acceptance criteria?


Availability and Testing


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