Skip to content

Commit

Permalink
Update channel information in steps that are scoped to Channels
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn committed Mar 14, 2016
1 parent f8a34fc commit 89c673f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions source/Octopus.Cli/Importers/ProjectImporter.cs
Expand Up @@ -148,7 +148,7 @@ protected override void Import(Dictionary<string, string> paramDictionary)
ImportProjectChannels(validatedImportSettings.Channels.ToList(), importedProject, validatedImportSettings.ChannelLifecycles)
.ToDictionary(k => k.Key, v => v.Value);

ImportDeploymentProcess(validatedImportSettings.DeploymentProcess, importedProject, validatedImportSettings.Environments, validatedImportSettings.Feeds, validatedImportSettings.Templates);
ImportDeploymentProcess(validatedImportSettings.DeploymentProcess, importedProject, validatedImportSettings.Environments, validatedImportSettings.Feeds, validatedImportSettings.Templates, importedChannels);

ImportVariableSets(validatedImportSettings.VariableSet, importedProject, validatedImportSettings.Environments, validatedImportSettings.Machines, importedChannels, validatedImportSettings.ScopeValuesUsed);

Expand Down Expand Up @@ -381,7 +381,8 @@ IList<VariableResource> UpdateVariables(VariableSetResource variableSet, IDictio
ProjectResource importedProject,
IDictionary<string, EnvironmentResource> environments,
IDictionary<string, FeedResource> nugetFeeds,
IDictionary<string, ActionTemplateResource> actionTemplates)
IDictionary<string, ActionTemplateResource> actionTemplates,
IDictionary<string, ChannelResource> channels)
{
Log.Debug("Importing the Projects Deployment Process");
var existingDeploymentProcess = Repository.DeploymentProcesses.Get(importedProject.DeploymentProcessId);
Expand Down Expand Up @@ -413,6 +414,16 @@ IList<VariableResource> UpdateVariables(VariableSetResource variableSet, IDictio
}
action.Environments.Clear();
action.Environments.AddRange(newEnvironmentIds);

var oldChannelIds = action.Channels;
var newChannelIds = new List<string>();
Log.Debug("Updating IDs of Channels");
foreach (var oldChannelId in oldChannelIds)
{
newChannelIds.Add(channels[oldChannelId].Id);
}
action.Channels.Clear();
action.Channels.AddRange(newChannelIds);
}
}
existingDeploymentProcess.Steps.Clear();
Expand Down

0 comments on commit 89c673f

Please sign in to comment.