Skip to content

Draft: Avoid mapping by connected GitHub accounts during gitea import

James Nutt requested to merge jnutt/prevent-gitea-github-mapping into master

What does this MR do and why?

Avoid mapping by connected GitHub accounts during gitea import

The Gitea import uses the LegacyGithubImport code. When mapping an imported user against current users on the system, the importer will check against any GitHub accounts connected to GitLab accounts on the destination system. This makes sense when importing from github.com to a GitLab instance, but not when importing from Gitea.

Changelog: fixed

MR acceptance checklist

  • I accidentally deleted the checklist line, but here!

How to set up and validate locally

Running a Gitea instance using Podman

  1. Create a local instance of Gitea using Podman.

    podman run -p 3001:3000 gitea/gitea:latest
  2. Navigate to http://localhost:3001 and register an account using an email address that matches a user in your GitLab instance.

  3. Navigate to http://localhost:3001/user/settings/applications and create an access token. Copy this token somewhere safe.

  4. Create a new repository containing a self-assigned issue.

Importing from Gitea to GitLab

  1. Enable Gitea import in your GitLab instance as per the GitLab documentation.
  2. Navigate to /projects/new#import_project and select Gitea.
  3. Enter your Gitea hostname (http://localhost:3001) and the Gitea access token you saved earlier.
  4. Create your decoy GitHub identity:
    # We use extern_uid: 1 assuming the matching Gitea user isthe
    # first one created in your temporary gitea system. You may need to
    # change this if that isn't true.
    Identity.create(provider: :github, user_id: User.last.id, extern_uid: 1)
  5. Proceed with the import.
  6. Confirm that the repository was successfully imported and the issue is assigned to the GitLab user with the email address matching your Gitea user.
Edited by James Nutt

Merge request reports