Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Mapping Users between environments #1776

Closed
MrHinsh opened this issue Dec 6, 2023 · 5 comments · Fixed by #1969
Closed

[Feature] Mapping Users between environments #1776

MrHinsh opened this issue Dec 6, 2023 · 5 comments · Fixed by #1969
Assignees

Comments

@MrHinsh
Copy link
Member

MrHinsh commented Dec 6, 2023

How to map users between the source and target system?

There needs to be a specific mapping engine for this when these values change dramatically.

Originally posted by @maf-soft in #1774

@MrHinsh MrHinsh self-assigned this Dec 6, 2023
@MrHinsh MrHinsh changed the title > Title: ExportUsersForMapping Mapping Users between environments Dec 6, 2023
@maf-soft
Copy link

maf-soft commented Dec 8, 2023

Great, here are some thoughts:

  • automatically handling all identity fields, mentions, comment authors would be nice
  • since ExportUsersForMapping already exists, that mapping format should be supported, ideally also by specifying the filename
  • mapping by RegEx, sometimes it is as easy as reversing firstname and lastname
  • auto detect common formats and find target users? or extend ExportUsersForMapping so it tries some auto mapping with existing target users and you can verify and edit in the file

@Angelos102
Copy link

Angelos102 commented Jan 12, 2024

Caution, when adding users into the new project, if you migrate history you get lots of notifications to mentioned users, so it should be highlighted as these notifications can NOT be turned off. If you do not add the users on the the project migration or project admins get the notification, so it should be a choice

@MrHinsh MrHinsh changed the title Mapping Users between environments [Feature] Mapping Users between environments Feb 27, 2024
@MrHinsh
Copy link
Member Author

MrHinsh commented Mar 5, 2024

Im looking at the mapping, and it sucks! Azure DevOps in the ObjectModel API stores only the friendly name...

@MrHinsh
Copy link
Member Author

MrHinsh commented Mar 7, 2024

##How it works

  1. Run ExportUsersForMappingConfig which will export all of the Users in Soruce Mapped or not to target.
  2. Run WorkItemMigrationConfig which will run a validator by detail to warn you of missing users. If it finds a mapping it will convert the field...

##Notes

  • Applies to all identity fields specified in the list
  • It really sucks that we have to match on Display name! Email is included for internal matching
  • On 'ExportUsersForMappingConfigyou can setOnlyListUsersInWorkItems` to filter the mapping based on the scope of the query. This is greater if you have many users.
  • Both use the 'TfsUserMappingEnricherOptionssetting inCommonEnrichersConfig` to know what to do.
{
  "ChangeSetMappingFile": null,
  "Source": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/nkdagility/",
    "Project": "AzureDevOps-Tools",
    "ReflectedWorkItemIDFieldName": "nkdScrum.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "Prompt",
    "PersonalAccessToken": "",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "Target": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/nkdagility-preview/",
    "Project": "migrationTest5",
    "ReflectedWorkItemIDFieldName": "nkdScrum.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "Prompt",
    "PersonalAccessToken": "",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "FieldMaps": [],
  "GitRepoMapping": null,
  "LogLevel": "Debug",
  "CommonEnrichersConfig": [
    {
      "$type": "TfsUserMappingEnricherOptions",
      "Enabled": true,
      "UserMappingFile": "C:\\temp\\userExport.json",
      "IdentityFieldsToCheck": [
        "System.AssignedTo",
        "System.ChangedBy",
        "System.CreatedBy",
        "Microsoft.VSTS.Common.ActivatedBy",
        "Microsoft.VSTS.Common.ResolvedBy",
        "Microsoft.VSTS.Common.ClosedBy"
      ]
    }
  ],
  "Processors": [
    {
      "$type": "ExportUsersForMappingConfig",
      "Enabled": true,
      "WIQLQuery": "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @TeamProject AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan','Shared Steps','Shared Parameter','Feedback Request') ORDER BY [System.ChangedDate] desc",
      "OnlyListUsersInWorkItems": true
    }
  ],
  "Version": "15.0",
  "workaroundForQuerySOAPBugEnabled": false,
  "WorkItemTypeDefinition": {
    "sourceWorkItemTypeName": "targetWorkItemTypeName"
  },
}

@MrHinsh MrHinsh linked a pull request Mar 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants