Group Export relations with subgroups
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
- Start sidekiq
rails c
[4] pry(main)> GroupExportWorker.perform_async(1, 8)
=> "b4adc4db71a03f107d74c2e7"
- 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
@cache_id=nil,
@file=
#<CarrierWave::SanitizedFile:0x00007f9232437c10
@content=nil,
@content_type=nil,
@file="/Users/.../gitlab/public/uploads/-/system/import_export_upload/export_file/1/2019-11-05_13-20-080_h5bp_export.tar.gz",
@original_filename=nil>,
@filename=nil,
- Check
group.json
in the archive -- verify information is exported, relations are included, subgroups are included.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation created/updated or follow-up review issue created
-
Code review guidelines - [-] Merge request performance guidelines
-
Style guides -
Database guides - [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
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 🤖