Reinstate Direct Transfer disabled message
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.
To validate the changes to the API message:
-
git checkout
into thereinstate-disabled-message
branch - 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.
- go to the
lib/api/group_export.rb
file, line 73 in the code, and monkey patch the endpoint to returnnot_found!
. This is to mimic the behavior of an instance where the setting is disabled:
before
after
- Using a personal access token with an
api
scope, in a terminal make a curl POST request to thegdk.test
bulk_imports endpoint to initiate a direct transfer fromgdk.test
togdk.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"
}
]
}'
- 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