Skip to content

User mapping - Integration with Gitea importer

Sam Word requested to merge 467084-gitea-user-mapping into master

What does this MR do and why?

This MR integrates our new improved user mapping into our Gitea importer so that users who import projects from Gitea can take advantage of choosing and reassigning contributions to users in GitLab.

If a user has been deleted on Gitea, Gitea returns a "ghost" user for the deleted user. Before user contribution mapping, these ghost users were attributed to the importing user, and that remains the same with user mapping (for now). It's kept the same for now because the other options seemed less ideal for an initial integration:

  • Assign contributions directly to a bot, but I didn't want to do that without further discussion or on an initial implementation, so it seemed best saved for a second MR.
  • Assign ghost contributions to a placeholder, but right now we can't reassign placeholders to any bots, including ghosts, so it didn't seem ideal.
  • Assign the contributions to an import user, but I didn't want to imply that the placeholder user limit was reached.

This implementation requires that both the importer_user_mapping and new gitea_user_mapping are enabled.

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.

Screenshots or screen recordings

Please note that sword_gitea was reassigned to Whiskers Gitlab. However, without contribution mapping enabled, the user's email matches Sam Word.

Without both flags enabled Feature enabled, before reassignment After reassignment
Issue from user image Pasted_image_20241008160510 image
Issue from deleted user on Gitea image Pasted_image_20241008160453 image
Open MR image Pasted_image_20241008160536 image
Merged MR image Pasted_image_20241008160603 image

How to set up and validate locally

  1. Enable and. Both must be enabled to see placeholder users be created and reassigned.
  2. Import a project from Gitea. The project from the screenshots is here.
  3. See that placeholder users have been created for Issue and Merge Request authors, assignees, and note authors. See that ghost users are mapped to the user who created the import. It's worth noting that even before this MR, we did not import reviewers, and only one assignee is returned from the API for issues and pull requests, so we only import one of those.
  4. Reassign a placeholder user to a real user and accept the reassignment. See that their contributions were reassigned

Related to #467084

Edited by Sam Word

Merge request reports

Loading