Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Error to import project using api/1.0/migration/imports

Antoine Ameline April 9, 2024

Hi

I have a bitbucket data-center server deployed on a Debian server.

I've been asked to deploy bitbucket data-center on our cluster. I did it using the helm chart provided by Atlassian.

Now I want to migrate my projects and repositories from my old instance to the new one (same data-center version 8.16.2 with a postgres base behind it).

To do this, I'd like to use the API described in the documentation 

 

No problem with export api it works well.

curl --location 'https://git.xxx.xxx.xx/bitbucket/rest/api/1.0/migration/exports' --header 'Content-Type: application/json' --header 'Authorization: Basic XXXXXXXXXXXXXXXXX' --data '{"repositoriesRequest":{"includes":[{"projectKey":"MDCONF","slug":"*"}]}}'

The file is generated. I copied it to my volume using "kubectl cp". The file size is 100 MB

 

My problem is to import the file in bitbucket.

Looking at documentation, I use the rest api/1.0/migration/imports but with failure 400 Bad Request 

First try with relative path to the file
curl --location 'https://git.xxx.xxx.xx/bitbucket/rest/api/1.0/migration/imports' --header 'Content-Type: application/json' --header 'Authorization: Basic XXXXXXXXXXXXXXXXX' --data '{"archivePath":"Bitbucket_export_2.tar"}'
{
    "errors": [
        {
            "context": null,
            "message": "Invalid import request, the archive 'Bitbucket_export_2.tar' could not be found",
            "exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"
        }
    ]
}
Second try with full path
curl --location 'https://git.xxx.xxx.xx/bitbucket/rest/api/1.0/migration/imports' --header 'Content-Type: application/json' --header 'Authorization: Basic XXXXXXXXXXXXXXXXX' --data '{"archivePath":"/var/atlassian/application-data/bitbucket/shared/data/migration/import/Bitbucket_export_2.tar"}'
{
    "errors": [
        {
            "context": null,
            "message": "Import archive location is invalid.",
            "exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"
        }
    ]
}
For the problem with the relative path, I checked my environment variables and $BITBUCKET_HOME is well set :
BITBUCKET_HOME=/var/atlassian/application-data/bitbucket
Looking at files, all seems to be ok : 
bitbucket_volume.png
How do I specify the archivePath to make the API work?
Thanks for your help
Antoine

1 answer

1 vote
Neeraj Upadhyay
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 16, 2024

When you export a project/repo, the export tar file is created in <Bitbucket-home>/shared/data/migration/export folder, this tar file needs to be copied to <Bitbucket-home>/shared/data/migration/import folder and after that you would have to run the Import API call

Kb: https://confluence.atlassian.com/bitbucketserver/importing-957497836.html

Andreas Pabst
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 30, 2024

Hi Neeraj, can you please give us a hint what might be the reason if the export works, but the import from the location you mentioned results in a "You are not permitted to access this resource" response? The credentials used are the same. We're using the Docker container 8.19.1 with an internal database.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.16.2
TAGS
AUG Leaders

Atlassian Community Events