Commit 89e90291 authored by Mike Jang's avatar Mike Jang

Merge branch '214847-add-ndjson-import_export-docs' into 'master'

Add import/export information to dev docs

See merge request gitlab-org/gitlab!29820
parents c94f82ae 6ed5331a
...@@ -331,3 +331,82 @@ module Projects ...@@ -331,3 +331,82 @@ module Projects
wiki_repo_saver, lfs_saver].all?(&:save) wiki_repo_saver, lfs_saver].all?(&:save)
end end
``` ```
## Test fixtures
Fixtures used in Import/Export specs live in `spec/fixtures/lib/gitlab/import_export`. There are both Project and Group fixtures.
There are two versions of each of these fixtures:
- A human readable single JSON file with all objects, called either `project.json` or `group.json`.
- A tree.tar.gz file containing a tree of files in `ndjson` format. **Please do not edit this file manually unless strictly necessary.**
The tools to generate the NDJSON tree from the human-readable JSON files live in the [`gitlab-org/memory-team/team-tools`](https://gitlab.com/gitlab-org/memory-team/team-tools/-/blob/master/import-export/) project.
### Project
**Please use `legacy-project-json-to-ndjson.sh` to generate the NDJSON tree.**
Once you're done generating the files, please package them using `tar -czf tree.tar.gz tree` from the same directory as the `tree` directory generated is located.
The NDJSON tree will look like this:
```shell
tree
├── project
│   ├── auto_devops.ndjson
│   ├── boards.ndjson
│   ├── ci_cd_settings.ndjson
│   ├── ci_pipelines.ndjson
│   ├── container_expiration_policy.ndjson
│   ├── custom_attributes.ndjson
│   ├── error_tracking_setting.ndjson
│   ├── external_pull_requests.ndjson
│   ├── issues.ndjson
│   ├── labels.ndjson
│   ├── merge_requests.ndjson
│   ├── milestones.ndjson
│   ├── pipeline_schedules.ndjson
│   ├── project_badges.ndjson
│   ├── project_feature.ndjson
│   ├── project_members.ndjson
│   ├── protected_branches.ndjson
│   ├── protected_tags.ndjson
│   ├── releases.ndjson
│   ├── services.ndjson
│   ├── snippets.ndjson
│   └── triggers.ndjson
└── project.json
```
### Group
**Please use `legacy-group-json-to-ndjson.rb` to generate the NDJSON tree.** This script can be found in [`gitlab-org/memory-team/team-tools!7`](https://gitlab.com/gitlab-org/memory-team/team-tools/-/merge_requests/7).
Once this MR is merged, the script will be found in the directory mentioned earlier.
Once you're done generating the files, please package them using `tar -czf tree.tar.gz tree` from the same directory as the `tree` directory generated is located.
The NDJSON tree will look like this:
```shell
tree
└── groups
├── 4351
│   ├── badges.ndjson
│   ├── boards.ndjson
│   ├── epics.ndjson
│   ├── labels.ndjson
│   ├── members.ndjson
│   └── milestones.ndjson
├── 4352
│   ├── badges.ndjson
│   ├── boards.ndjson
│   ├── epics.ndjson
│   ├── labels.ndjson
│   ├── members.ndjson
│   └── milestones.ndjson
├── _all.ndjson
├── 4351.json
└── 4352.json
```
CAUTION: **Caution:** When updating these fixtures, please ensure you update the `json` files and the `tar.gz` archives, as the tests apply to both.
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