private async Task <ReleasePlan> BuildReleasePlan(ProjectResource project) { if (!string.IsNullOrWhiteSpace(ChannelName)) { commandOutputProvider.Information("Building release plan for channel '{Channel:l}'...", ChannelName); channels = await Repository.Projects.GetChannels(project).ConfigureAwait(false); var matchingChannel = await channels .FindOne(Repository, c => c.Name.Equals(ChannelName, StringComparison.OrdinalIgnoreCase)).ConfigureAwait(false); if (matchingChannel == null) { throw new CouldNotFindException($"a channel in {project.Name} named", ChannelName); } return(await releasePlanBuilder.Build(Repository, project, matchingChannel, VersionPreReleaseTag).ConfigureAwait(false)); } // All Octopus 3.2+ servers should have the Channels hypermedia link, we should use the channel information // to select the most appropriate channel, or provide enough information to proceed from here if (ServerSupportsChannels()) { commandOutputProvider.Debug("Automatically selecting the best channel for this release..."); return(await AutoSelectBestReleasePlanOrThrow(project).ConfigureAwait(false)); } // Compatibility: this has to cater for Octopus before Channels existed commandOutputProvider.Information("Building release plan without a channel for Octopus Server without channels support..."); return(await releasePlanBuilder.Build(Repository, project, null, VersionPreReleaseTag).ConfigureAwait(false)); }
async Task <ReleasePlan> BuildReleasePlan(ProjectResource project) { if (!string.IsNullOrWhiteSpace(ChannelNameOrId)) { commandOutputProvider.Information("Building release plan for channel '{Channel:l}'...", ChannelNameOrId); var matchingChannel = await Repository.Channels.FindByNameOrIdOrFail(project, ChannelNameOrId).ConfigureAwait(false); return(await releasePlanBuilder.Build(Repository, project, matchingChannel, VersionPreReleaseTag, GitReference) .ConfigureAwait(false)); } // All Octopus 3.2+ servers should have the Channels hypermedia link, we should use the channel information // to select the most appropriate channel, or provide enough information to proceed from here if (await ServerSupportsChannels().ConfigureAwait(false)) { commandOutputProvider.Debug("Automatically selecting the best channel for this release..."); return(await AutoSelectBestReleasePlanOrThrow(project).ConfigureAwait(false)); } // Compatibility: this has to cater for Octopus before Channels existed commandOutputProvider.Information("Building release plan without a channel for Octopus Server without channels support..."); return(await releasePlanBuilder.Build(Repository, project, null, VersionPreReleaseTag, GitReference) .ConfigureAwait(false)); }