Skip to content

[PoC] Export a single group relation to ndjson file and send it to BulkImport ETL pipeline for import via callback

George Koltsov requested to merge georgekoltsov/bulk-import-ndjson-etl into master

What does this MR do?

This MR is a proof of concept of using ndjson relation export to be used in Bulk Import and it's ETL pipelines.

Implements 2 new group endpoints:

  • Group relation export. Exports specified relation to ndjson file and sends it to provided callback url when it's complete
  • Group relation import. Receives ndjson file and started Bulk Import ETL pipeline to process them

Added ndjson_pipeline! attribute to BulkImport Pipeline type, in order to request ndjson file from source instance before doing any processing, since it relies on the file to be present.

Newly added ETL pipeline contains a lot of copy paste from existing various parts of Import/Export codebase, e.g. relation tree restorer, relation factory, object builder, etc. In a nutshell what is done there is, for each line in ndjson file:

  1. JSON decode into Hash
  2. Recursively traverse all nested hashes and convert them to corresponding relation class objects based on existing import_export.yml configuration from Import/Export code
  3. Save converted Epic object with all of its nested objects (award emoji, notes, events, etc).

Every epic carried over it's subrelations: award emoji, notes and note award emoji. Import of 1k epics took less than 2 minutes.

In terms of security, we will probably need to include some sort of authenticity token/user information for relation export/import to make sure the request that comes in is legit.

epics2

Screenshots (strongly suggested)

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 George Koltsov

Merge request reports