GitHub Importer - Map contributions to personal namespace owner
What does this MR do and why?
This MR updates the GitHub importer so that when a project is imported into a personal user namespace, all user contributions are assigned to the personal namespace owner. Because personal namespaces don't have memberships like groups, there's no way for a user to reassign placeholder users via the UI. Plus, user contribution mapping isn't supported in personal namespaces, so it's simpler to immediately map contributions to the namespace owner.
This MR includes refactors to how placeholder references are pushed to Redis during the import:
- Replaced
Gitlab::GithubImport::PushPlaceholderReferenceswithImport::PlaceholderReferences::Pusherbecause they were almost identical except for a few additional methods added onPushPlaceholderReferencesthat the Github importer needed. It also makes the user mapping implementation in the GitHub importer much more similar to its implementation in the Bitbucket Server importer, solidifying implementation patters. - Updated
Import::PlaceholderReferences::Pusherto include the methods needed by GitHub imports - Removed
Gitlab::GithubImport::ContributionsMapper. It was used to pass the user mapper toPushPlaceholderReferences, and inUserFinder. Now thatPusherhandles instantiatingSourceUserMapper, there wasn't much need to keep this class. The same feature flag checks defined onContributionsMapperare also defined onPusher, so they're still accessible when needed.
References
- Related to #525342 (closed)
- Implementation in Bitbucket Server importer: !198010 (merged)
- Implementation in Gitea importer: !200716 (merged)
Screenshots or screen recordings
How to set up and validate locally
- Enable
user_mapping_to_personal_namespace_owner - Ensure you have access to a Github repository with user contributions. See import from GitHub docs for instructions and prerequisites
- Import a repository from GitHub into a personal namespace
- Verify that all user contributions have been mapped to the namespace owner
- Import the project to group
- Verify that placeholder users were created and user mapping is unaffected
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #525342 (closed)
Edited by Sam Word




