nkdAgility / azure-devops-migration-tools

Azure DevOps Migration Tools allow you to migrate Teams, Backlogs, Work Items, Tasks, Test Cases, and Plans & Suits from one Project to another in Azure DevOps / TFS both within the same Organisation, and between Organisations.
https://nkdagility.com/learn/azure-devops-migration-tools/
GNU Affero General Public License v3.0
499 stars 331 forks source link

Issue with the AzureDevOpsPipelineProcessor #1676

Closed guyappy closed 1 year ago

guyappy commented 1 year ago

Version

Source Version

Azure DevOps Service

Target Version

Azure DevOps Service

Relevant configuration

{
  "Version": "13.1",
  "LogLevel": "Verbose",
  "workaroundForQuerySOAPBugEnabled": false,
  "Source": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://enecoazureplatform.visualstudio.com//",
    "Project": "Apigee Edge",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AuthenticationMode": "AccessToken",
    "AllowCrossProjectLinking": false,
    "PersonalAccessToken": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "Target": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/enecomanagedcloud/",
    "Project": "Apigee Edge",
    "ReflectedWorkItemIDFieldName": "nkdScrum.ReflectedWorkItemId",
    "AuthenticationMode": "AccessToken",
    "AllowCrossProjectLinking": false,
    "PersonalAccessToken": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "FieldMaps": [
    {
      "$type": "TreeToTagMapConfig",
      "WorkItemTypeName": "*",
      "toSkip": 3,
      "timeTravel": 1
    }
  ],
  "WorkItemTypeDefinition": {
    "sourceWorkItemTypeName": "targetWorkItemTypeName"
  },
  "GitRepoMapping": null,
  "Endpoints": {
    "TfsTeamSettingsEndpoints": [
      {
        "Name": "TeamSettingsSource",
        "AccessToken": "",
        "Organisation": "https://enecoazureplatform.visualstudio.com/",
        "Project": "Apigee Edge",
        "ReflectedWorkItemIdField": "ReflectedWorkItemId",
        "AllowCrossProjectLinking": false,
        "LanguageMaps": {
          "Area": "Apigee Edge",
          "Iteration": "Apigee Edge"
        }
      },
      {
        "Name": "TeamSettingsTarget",
        "AccessToken": "",
        "Organisation": "https://dev.azure.com/enecomanagedcloud/",
        "Project": "Apigee Edge",
        "ReflectedWorkItemIdField": "ReflectedWorkItemId",
        "AllowCrossProjectLinking": false,
        "LanguageMaps": {
          "AreaPath": "Apigee Edge",
          "Iteration": "Apigee Edge"
        }
      }
    ],
    "AzureDevOpsEndpoints": [
      {
        "Name": "Source",
        "AccessToken": "",
        "Organisation": "https://enecoazureplatform.visualstudio.com/",
        "Project": "Apigee Edge",
        "ReflectedWorkItemIdField": "ReflectedWorkItemId",
        "AllowCrossProjectLinking": false,
        "LanguageMaps": {
          "Area": "Apigee Edge",
          "Iteration": "Apigee Edge"
        }
      },
      {
        "Name": "Target",
        "AccessToken": "",
        "Organisation": "https://dev.azure.com/enecomanagedcloud/",
        "Project": "Apigee Edge",
        "ReflectedWorkItemIdField": "ReflectedWorkItemId",
        "AllowCrossProjectLinking": false,
        "LanguageMaps": {
          "AreaPath": "Apigee Edge",
          "Iteration": "Apigee Edge"
        }
      }
    ]
  },
  "Processors": [
    {
      "$type": "TfsTeamSettingsProcessorOptions",
      "Enabled": true,
      "MigrateTeamSettings": false,
      "UpdateTeamSettings": false,
      "PrefixProjectToNodes": false,
      "MigrateTeamCapacities": false,
      "Teams": null,
      "ProcessorEnrichers": null,
      "SourceName": "TeamSettingsSource",
      "TargetName": "TeamSettingsTarget"
    },
    {
      "$type": "AzureDevOpsPipelineProcessorOptions",
      "Enabled": true,
      "MigrateBuildPipelines": true,
      "MigrateReleasePipelines": false,
      "MigrateTaskGroups": false,
      "MigrateVariableGroups": false,
      "MigrateServiceConnections": false,
      "BuildPipelines": null,
      "ReleasePipelines": null,
      "RepositoryNameMaps": null,
      "ProcessorEnrichers": null,
      "SourceName": "Source",
      "TargetName": "Target"
    }
  ]
}

Relevant log output

[15:46:10 INF] Querying definitions in the project: Apigee Edge
[15:46:10 INF] Configured BuildDefinition definitions: All
[15:46:30 INF] Querying definitions in the project: Apigee Edge
[15:46:30 INF] Configured BuildDefinition definitions: All
[15:46:36 INF] 229 of 229 source BuildDefinition(s) are going to be migrated..
[15:46:36 FTL] Error while running AzureDevOpsPipelineProcessor
System.NullReferenceException: Object reference not set to an instance of an object.
   at MigrationTools.Processors.AzureDevOpsPipelineProcessor.MapRepositoriesInBuidDefinition(IEnumerable`1 sourceRepositories, IEnumerable`1 targetRepositories, BuildDefinition definitionToBeMigrated) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.Rest\Processors\AzureDevOpsPipelineProcessor.cs:line 393
   at MigrationTools.Processors.AzureDevOpsPipelineProcessor.<CreateBuildPipelinesAsync>d__17.MoveNext() in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.Rest\Processors\AzureDevOpsPipelineProcessor.cs:line 312
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MigrationTools.Processors.AzureDevOpsPipelineProcessor.<MigratePipelinesAsync>d__9.MoveNext() in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.Rest\Processors\AzureDevOpsPipelineProcessor.cs:line 95
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MigrationTools.Processors.AzureDevOpsPipelineProcessor.InternalExecute() in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.Rest\Processors\AzureDevOpsPipelineProcessor.cs:line 49
   at MigrationTools.Processors.Processor.Execute() in D:\a\1\s\src\MigrationTools\Processors\Processor.cs:line 106
[15:46:36 INF] AzureDevOpsPipelineProcessor completed in 00:00:26.4761477

What happened?

EDIT: sorry the issue was that I had this in my configuration: "RepositoryNameMaps": null, and it should be: "RepositoryNameMaps": {},

I'm trying to migrate my pipelines. I have already migrated all the repo's to the net Azure DevOps Project. Really not sure why this is failing.

For the project I tried both "Project": "Apigee Edge" and "Project": "Apigee%20Edge"

It seems to fail on this line: if (_Options.RepositoryNameMaps.ContainsKey(sourceRepositoryName))

but really not sure how this can be null..

I ran a debug and saw this: image

many thanks in advance, Guy

Debug in Visual Studio

tomfrenzel commented 1 year ago

Hi @guyappy !

EDIT: sorry the issue was that I had this in my configuration: "RepositoryNameMaps": null, and it should be: "RepositoryNameMaps": {},

So can we close the issue or are you still receiving the error?

guyappy commented 1 year ago

hi @tomfrenzel , thanks, this can be closed.