Skip to content

Reinstate Direct Transfer disabled message

Carla Drago requested to merge reinstate-disabled-message into master

What does this MR do and why?

This reinstates the return of the group import disabled message when the export_relations/status endpoint returns a 404. This change rescues any network error, but only raises BulkImports::Error.setting_not_enabled if the response is a 404. Otherwise we return the error as is, meaning any blocked url or 403 error will still be returned.

Changelog: fixed

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Numbered steps to set up and validate the change are strongly suggested.

To validate the changes to the API message:

  1. git checkout into the reinstate-disabled-message branch
  2. in the UI, under Admin > Settings > General > Visibility and access controls, make sure "Allow migrating GitLab groups and projects by direct transfer" is enabled. [Save] any changes if required.
  1. go to the lib/api/group_export.rb file, line 73 in the code, and monkey patch the endpoint to return not_found!. This is to mimic the behavior of an instance where the setting is disabled:
before
after
  1. Using a personal access token with an api scope, in a terminal make a curl POST request to the gdk.test bulk_imports endpoint to initiate a direct transfer from gdk.test to gdk.test:
curl --location --request POST 'http://gdk.test:3000/api/v4/bulk_imports' \
--header 'Authorization: Bearer [ACCESS TOKEN]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "configuration": {
        "url": "http://gdk.test:3000",
        "access_token": [ACCESS TOKEN]
    },
    "entities": [
        {
            "source_full_path": "source_full_path",
            "source_type": "group_entity",
            "destination_slug": "your-destination",
            "destination_namespace": "your-destination-namespace"
        }
    ]
}'
  1. You should see the response:
{"message":"Migration by direct transfer disabled on source or destination instance. Ask an administrator to enable it on both instances and try again."}
Edited by Carla Drago

Merge request reports