OctopusDeploy / Issues

| Public | Bug reports and known issues for Octopus Deploy and all related tools
https://octopus.com
162 stars 20 forks source link

Release creation fails if step with multiple packages is used as the versioning step #5506

Closed slewis74 closed 5 years ago

slewis74 commented 5 years ago

Are you a customer of Octopus Deploy? Don't raise the issue here. Please contact our support team so we can triage your issue, making sure it's handled appropriately.

Prerequisites

The bug

There are 2 related bugs. They both occur when you use a step that has multiple packages as the versioning step for the project.

The first occurs through octo.exe create-release, when it calls to get the release plan it only gets back a step name but no package reference name. This means it goes looking through the packages in the plan (which are all packages from all steps) using a SingleOrDefault on the step name and comes up with an exception because there are more than 1 result.

The second bug occurs if you create the release through the portal. The create release UI similarly is only checking the step name when looking for the versioning package. This means that editing the version of any of the packages on the step results in the release version being changed, even if the package isn't the one selected as the versioning package.

What I expected to happen

The release should be created using the version from the package selected on the project settings page.

Steps to reproduce

  1. Create a project with a single script step and add 2 packages to it
  2. Select one of the packages as the release versioning package
  3. Follow the details provided above to try to create a release either through octo.exe or the portal

Screen capture

Following is UI creating a release, version should be based on the Test package, not the NuGet.CommandLine package image

Log exerpt

Following is from a TeamCity build log, i.e. using octo.exe

[15:45:10]  [Octopus Deploy] Finding project: Data
[15:45:10]  [Octopus Deploy] Automatically selecting the best channel for this release...
[15:45:10]  [Octopus Deploy] Building a release plan for Channel 'Default'...
[15:45:10]  [Octopus Deploy] Finding deployment process...
[15:45:11]  [Octopus Deploy] Finding release template...
[15:45:11]  [Octopus Deploy] The package version for some steps was not specified. Going to try and resolve those automatically...
[15:45:11]  [Octopus Deploy] Finding latest package for step: Push
[15:45:11]  [Octopus Deploy] Selected 'Octopus.Data' version '3.2.1-ci0006' for 'Push'
[15:45:11]  [Octopus Deploy] Finding latest package for step: Push
[15:45:12]  [Octopus Deploy] Selected 'NuGet.CommandLine' version '4.9.4' for 'Push'
[15:45:12]  [Octopus Deploy] Selected the release plan for Channel 'Default' - it is a perfect match
[15:45:12]  [Octopus Deploy] 
[15:45:12]  [Octopus Deploy] System.InvalidOperationException: Sequence contains more than one matching element
[15:45:12]  [Octopus Deploy]    at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
[15:45:12]  [Octopus Deploy]    at Octopus.Cli.Commands.Releases.ReleasePlan.GetActionVersionNumber(String packageStepName)
[15:45:12]  [Octopus Deploy]    at Octopus.Cli.Commands.Releases.CreateReleaseCommand.<Request>d__36.MoveNext()
[15:45:12]  [Octopus Deploy] --- End of stack trace from previous location where exception was thrown ---
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[15:45:12]  [Octopus Deploy]    at Octopus.Cli.Commands.ApiCommand.<Execute>d__39.MoveNext()
[15:45:12]  [Octopus Deploy] --- End of stack trace from previous location where exception was thrown ---
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
[15:45:12]  [Octopus Deploy]    at Octopus.Cli.Commands.ApiCommand.<Execute>d__37.MoveNext()
[15:45:12]  [Octopus Deploy] --- End of stack trace from previous location where exception was thrown ---
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[15:45:12]  [Octopus Deploy]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[15:45:12]  [Octopus Deploy]    at Octopus.Cli.CliProgram.Run(String[] args)

Affected versions

Octopus Server: 2018.8+

Octo.exe 4.42.0+

Workarounds

None

Links

hnrkndrssn commented 5 years ago

Another report of the second bug here https://help.octopus.com/t/multiple-package-project-release-versioning-issue/22784

octoreleasebot commented 5 years ago

Release Note: Fixed issue with creating releases when multiple packages exist on the versioning step

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.