Skip to content
Snippets Groups Projects
Commit b92940ef authored by Donghee Kang's avatar Donghee Kang
Browse files

Add simpla usage and instructuion on readme

parent 910ef918
No related branches found
No related tags found
No related merge requests found
# Migration
Useful migration tools
Useful python migration tools
## Requirement
`python-gitlab` requires `Python 3.8+` at least.
Use pip to install the latest stable version of python-gitlab
> pip install --upgrade python-gitlab
 
## 1. Group "my_group" on pilot gitlab -> Group "my_group" on new GitLab at KIT
Usage: migration_group_export_import.py
1. add your personal access token (PAT) getting from the source and target gitlab both.
2. In source(pilot) gitlab, find out the group id, which will be migrated. You should access it from the web browser.
3. In target(new) gitlab, define the `path`` of your subgroup. (not group name)
- `group_namespace_in_target = 'kit/institute/migration'`
In the target gitlab, a group structure "KIT / Institute" has to be eanbled in advance.
If the last subgroup "migration" is not existing, "migration" will be created first and projects wil be transferred on this subgroup.
If the last subgroup "migration" is already existing, then all projects will be transferred to existing subgroup, directly.
> $ python3 migration_group_export_import.py
Procedure:
1. Exporting projects in a group `my_group` from the source gitlab. You needs to know `group_id` for this group `my_group`
2. Download exported files to the local directory `"{PWD}/exported_files"`
3. Importing the exported files to the target gitlab on `"kit/institute/migration"`
 
## 2. Group "my_group" on pilot gitlab -> Group "my_group" on new GitLab at KIT
Usage: migration_group_import_only.py
1. add your personal access token (PAT) getting from the target gitlab only.
2. define a set of exported files, that are located under the local directory `"{PWD}/exported_files"`
3. In target(new) gitlab, define the path of your subgroup
- `group_namespace_in_target = 'kit/institute/migration'`
In the target gitlab, a group structure "KIT / Institute" has to be eanbled in advance.
If the last subgroup "migration" is not existing, "migration" will be created first and projects wil be transferred on this subgroup.
If the last subgroup "migration" is already existing, then all projects will be transferred to existing subgroup, directly.
> $ python3 migration_group_improt_only.py
Procedure:
1. No exporting and download is requried. In the directory`"{PWD}/exported_files"` all `*_exported.tar.gz"` files(=projects) are enabled to use.
2. Importing the exported files to the target gitlab on the subgroup `"kit/institute/migration"`
 
## 3. Project "my_project" on pilot gitlab -> Project "my_project" on new GitLab at KIT
Usage: migration_project_export_improt.py
1. add your personal access token (PAT) getting from the source and target gitlab both.
2. In source(pilot) gitlab, find the project id or project namespace.
- `project_id_in_source = 123456789`
- `source_namespace = 'xx1234/my_project'`
3. In target(new) gitlab, define the private namespace. It would be <vornaem.nachname> in general.
- `target_namespace = 'firstname.lastname'`
If project_id_in_source is used, you do not need to defind source_namespace. But if you do not use project_id_in_source, then you have to write the project namespace(path) explicitly.
For the target namespace, you have to define your private namespace as default, where the project will be transferred.
> $ python3 migration_group_export_import.py
Procedure:
1. Exporting a single project from the source gitlab.
2. Download exported file to the local directory `"{PWD}/exported_files"`
3. Importing the exported file to the target gitlab on private namesapce `"firstname.lastname"`
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment