Coder Social home page Coder Social logo

swoodford / migrate_bitbucket_server_to_bitbucket_cloud Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 17.0 54 KB

Migrate Atlassian Bitbucket Server to Bitbucket Cloud

License: Apache License 2.0

Shell 100.00%
migrate atlassian bitbucket server cloud stash git linux bash bitbucket-server

migrate_bitbucket_server_to_bitbucket_cloud's People

Contributors

francolucas avatar swoodford avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

migrate_bitbucket_server_to_bitbucket_cloud's Issues

migratePhases=true mode does not seem to recognize PHASEFILE and SERVERAPIPASS variables

Issue Type

  • Bug Report

Script Name

migrate_bitbucket_server_to_bitbucket_cloud - migrate.sh

Bitbucket Server Version

Paste verbatim output from Bitbucket Server Version between quotes below

Atlassian Bitbucket v5.1.0

OS / Environment

Red Hat Enterprise Linux Server 7.5

Summary & Steps to Reproduce

Your script is a lifesaver!!! I appreciate all the effort that went into this. However, I'm having some issues with a phased migration.

When attempting to run the migrate.sh script with migratePhases=true, two issues present themselves:

  1. The filename specified in the PHASEFILE variable does not work. Instead, I have to edit the phase1.txt file. This is no big deal in practice, but I'm not sure why it's the case. Here's what I am using:
# Migration can be done in one of three ways:
# Using Function migrateALL, will migrate ALL Projects and ALL Repos found on Bitbucket Server
migrateALL=false

# OR using Function migratePhases which is a plain text file containing a list of
# Project Keys and Repo Slugs separated by a TAB in the text file set in variable PHASEFILE
# This was designed to use values pasted from a spreadsheet with one or more rows containing projects and repo slugs
migratePhases=true
PHASEFILE="mob-repos.txt"
PHASENUMBER="1"

...still wants to use phase1.txt.

  1. I am prompted for a password for each repo and branch during the # Git Checkout, Git Pull, Git Fetch on every branch in the repo stage. I have the following set:
# Username and password for Bitbucket Server account with Admin or System Admin level permissions on your Bitbucket Server
# This user must be able to read all Projects and all Repos in order to backup & migrate the entire server to cloud
SERVERAPIUSER="migration-user"
SERVERAPIPASS="migration-password"

I am not prompted for a password when running migrateALL=true. This obviously presents a much more cumbersome issue. I am trying to find the root cause in the script, but it's a bit over my head.

Any help is appreciated!!!

Expected Results

migratePhases=true mode recognizes PHASEFILE and SERVERAPIPASS variables

Actual Results

migratePhases=true mode does not recognize PHASEFILE and SERVERAPIPASS variables


Access token expired

Getting following error when running the script:

Begin cloudProject
{
  "type": "error",
  "error": {
    "message": "Access token expired. Use your refresh token to obtain a new access token."
  }
}

Command:

root@REDACTED:~/migrate_bitbucket_server_to_bitbucket_cloud# ./migrate.sh


============================================================
============================================================
============================================================
Beginning Bitbucket Migration
09-19-2018 14:38:50
============================================================
============================================================
============================================================


Begin migrateALL
============================================================
1 Project: REDACTED
Repo: REDACTED
Begin Local Backup
Switched to branch 'REDACTED'
Already up-to-date.
Switched to branch 'develop'
Already up-to-date.
Switched to branch 'master'
Already up-to-date.
Begin cloudProject
{
  "type": "error",
  "error": {
    "message": "Access token expired. Use your refresh token to obtain a new access token."
  }
}
Begin cloudRepo
Failure: Error checking if repo exists in Cloud:
Failure: Error creating repo in Cloud:
Failure:

Forbidden

Hi!

We seem to have an issue using this script, despite creating Oauth credentials according to your instructions (with all boxes ticked). The output is

Begin cloudProject
{
"type": "error",
"error": {
"message": "Forbidden"
}
}

Support project keys with "invalid" characters

Is your feature request related to a problem? Please describe.
Currently the Cloud API throws an exception and the migration proccess fails if a project key contains a non-supported character like "-".

Describe the solution you'd like
There should be an option to sanitize project keys, in order to automatically convert dashes to underscores, or better, convert anything non supported to underscores.

Describe alternatives you've considered
Rename the projects before migration.

{
"type": "error",
"error": {
"fields": {
"key": [
"Project keys must start with a letter and may only consist of ASCII letters, numbers and underscores (A-Z, a-z, 0-9, _)"
]
},
"message": "Bad request"
}
}

Improvement for not available variables

Hey Dude

Thanks for your script, it really helped me and i saved a lot time to migrate my repos.

This is not actually a bug request, more of an improvement. Im not a bash specialist so i cannot make a PR with the fixes.

This two variables need to be present, otherwise following commands will fail:

  • LFSREPOS
  • MIGRATEDREPOS

Maybe helpfull:

  • zsh 5.6.2 (x86_64-apple-darwin17.7.0)
  • macOS Mojave, 10.14.2 (18C54)
  • if you need anything else, tell me!

Again, thanks for your work!

Kind Regards
Ales

Change of Atlassian Endpoint

Issue Type

  • Bug Report

Script Name

migrate.sh

The API endpoints of Atlassian have changed. Replace the /teams/ part of the url with /workspaces/ in order to make the script functional again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.