Skip to content

Import Bitbucket pull requests

Madelein van Niekerk requested to merge 412614-import-prs into master

What does this MR do and why?

Makes the BitBucket Cloud importer parallel instead of running sequentially in order to fix migration timeouts. This follows the same framework as the GitHub importer and the BitBucket Server importer.

The work is split into the following MRs:

The feature is behind bitbucket_parallel_importer feature flag so that it is safe to continue releasing bits without affecting the importer. The feature flag is controlled in lib/gitlab/import_sources.rb.

Important notes

  • We attempt to find a user matching the users (for author and reviewers) and store the result in a cache (negative and positive results)
  • If the imported author is not found on gitlab, the author is set to the user performing the import
  • The author of the MR is set as the assignee since Bitbucket does not have assignees

How to set up and validate locally

  1. Follow https://docs.gitlab.com/ee/integration/bitbucket.html to setup OAuth for BitBucket Cloud. You will need an account on https://bitbucket.org/ that uses the same email address as the account on the gdk instance. You may need to create a new user on the gdk for this.
  2. Make sure you add the bitbucket configuration in the development section of your config/gitlab.yml as shown at https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/gitlab-oauth2.md#set-up-gdk:
    development:
      <<: *base
      omniauth:
        providers:
        - { name: 'bitbucket',
            app_id: '...',
            app_secret: '...' }
  3. Log into the gdk with the relevant user credentials and in ...-/profile/account connect bitbucket there:
  1. Create a project and repo on BitBucket. Push up some code in a new branch and create a new merge request.
  2. Enable the feature flag: Feature.enable(:bitbucket_parallel_importer)
  3. On your gdk instance, create a new project > click on Import project > Bitbucket Cloud > follow instructions to connect to https://bitbucket.org/.
  4. Import the project created in step 2.
  5. Verify that the merge request was imported correctly.
  6. You can also view the importer logs to see when each step was executed or if there are errors: tail -f log/importer.log

MR acceptance checklist

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

Related to #412614 (closed)

Edited by Madelein van Niekerk

Merge request reports