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

Several fixes to the Pipeline Processor (again😄) #896

Merged
merged 5 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ServiceConnections to Build Pipelines
  • Loading branch information
tomfrenzel committed Mar 29, 2021
commit 1786e99496ea55dc6296a4af877280edd83e9101

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,19 @@ private async Task<IEnumerable<Mapping>> CreateBuildPipelinesAsync(IEnumerable<M

var sourceDefinitions = await Source.GetApiDefinitionsAsync<BuildDefinition>();
var targetDefinitions = await Target.GetApiDefinitionsAsync<BuildDefinition>();
var sourceServiceConnections = await Source.GetApiDefinitionsAsync<ServiceConnection>();
var targetServiceConnections = await Target.GetApiDefinitionsAsync<ServiceConnection>();
var definitionsToBeMigrated = FilterOutExistingDefinitions(sourceDefinitions, targetDefinitions);

definitionsToBeMigrated = FilterAwayIfAnyMapsAreMissing(definitionsToBeMigrated, TaskGroupMapping, VariableGroupMapping);
// Replace taskgroup and variablegroup sIds with tIds
foreach (var definitionToBeMigrated in definitionsToBeMigrated)
{
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;

if (TaskGroupMapping is not null)
{
foreach (var phase in definitionToBeMigrated.Process.Phases)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.Dynamic;
using System.Linq;
using Microsoft.VisualStudio.Services.Common;
using Newtonsoft.Json;


namespace MigrationTools.DataContracts.Pipelines
{
Expand Down Expand Up @@ -73,7 +71,6 @@ public override void ResetObject()
Revision = 0;
Id = null;
Project = null;
Repository.Id = null;

//Remove secure files
Process.Phases.ForEach(p => p.Steps.ForEach(s =>
Expand All @@ -90,7 +87,7 @@ public override void ResetObject()

public override bool HasTaskGroups()
{
return Process.Phases.Any(p => p.Steps.Any(s => s.Task.DefinitionType.ToString() == "metaTask"));
return Process.Phases.Any(p => p.Steps.Any(s => s.Task.DefinitionType.ToString() == "metaTask"));
}

public override bool HasVariableGroups()
Expand Down Expand Up @@ -305,6 +302,7 @@ public partial class Repository

public partial class Properties
{
public string ConnectedServiceId { get; set; }
public string CleanOptions { get; set; }

public string LabelSources { get; set; }
Expand Down