Skip to content

Allow project migrations in GitLab Direct Transfer

What does this MR do and why?

Allow users to create GitLab Direct Transfer of type project via API. This way, users can migrate projects decoupled from the parent group.

Notes:

  1. Although it'd be possible to allow users to migrate projects from users' namespace, I didn't enable the such feature and kept the destination namespace limited to groups.
  2. The project migration is limited to users having the roles maintainer or owner following the conditions described in #387891 (closed)
  3. This change also alters how the destination namespace is validated. Now, GitLab Direct Transfer validates the existence of the namespace and if the user has access to it.

Related to: #390515 (closed)

Screenshots or screen recordings

projects

How to set up and validate locally

  1. Enable GitLab Direct Transfer (Admin -> Settings -> General -> Visibility and access controls -> Allow migrating GitLab groups and projects by direct transfer
  2. Initiate a project migration using GitLab Direct Transfer API.
curl --location 'http://gdk.test:3000/api/v4/bulk_imports' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
    "configuration": {
        "url": "http://gdk.test:3000/",
        "access_token": "ACCESS_TOKEN"
    },
    "entities": [
        {
            "source_full_path": "gitlab-org/gitlab-test",
            "source_type": "project_entity",
            "destination_namespace": "DESTINATION_NAMESPACE",
            "destination_slug": "DESTINATION_SLUG"
        }
    ]
}'
  1. Check if the project was migrated successfully
  2. Check if there is no error in the GitLab Direct Transfer history page (/import/bulk_imports/history)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Carla Drago

Merge request reports