Skip to content

Commit

Permalink
#1900 Add workaround for missing repository properties when migrating…
Browse files Browse the repository at this point in the history
… build pipelines
  • Loading branch information
tomfrenzel committed Feb 23, 2024
1 parent a0ecddb commit 60ee181
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private IEnumerable<TaskGroup> FilterOutIncompatibleTaskGroups(IEnumerable<TaskG
{
Log.LogWarning(
@"{DefinitionType} ""{DefinitionName}"" cannot be migrated because the Task(s) ""{MissingTaskNames}"" are not available. This usually happens if the extension for the task is not installed.",
typeof(TaskGroup).Name, g.Name ,string.Join(",", missingTasksNames));
typeof(TaskGroup).Name, g.Name, string.Join(",", missingTasksNames));
return false;
}
return true;
Expand Down Expand Up @@ -303,13 +303,15 @@ private async Task<IEnumerable<Mapping>> CreateBuildPipelinesAsync(IEnumerable<M
// Replace taskgroup and variablegroup sIds with tIds
foreach (var definitionToBeMigrated in definitionsToBeMigrated)
{
var sourceConnectedServiceId = definitionToBeMigrated.Repository.Properties.ConnectedServiceId;
var sourceConnectedServiceId = definitionToBeMigrated.Repository?.Properties?.ConnectedServiceId;
var targetConnectedServiceId = targetServiceConnections.FirstOrDefault(s => sourceServiceConnections
.FirstOrDefault(c => c.Id == sourceConnectedServiceId)?.Name == s.Name)?.Id;
definitionToBeMigrated.Repository.Properties.ConnectedServiceId = targetConnectedServiceId;


MapRepositoriesInBuidDefinition(sourceRepositories, targetRepositories, definitionToBeMigrated);
if (definitionToBeMigrated.Repository?.Properties != null)
{
definitionToBeMigrated.Repository.Properties.ConnectedServiceId = targetConnectedServiceId;
MapRepositoriesInBuidDefinition(sourceRepositories, targetRepositories, definitionToBeMigrated);
}

if (TaskGroupMapping is not null)
{
Expand Down

0 comments on commit 60ee181

Please sign in to comment.