Issues icon indicating copy to clipboard operation
Issues copied to clipboard

"Sequence contains more than one matching element" error when creating a release in the CLI when release versioning set to a referenced package on a step that includes a deployment package

Open donnybell opened this issue 3 years ago • 3 comments

Team

  • [X] I've assigned a team label to this issue

Severity

Not blocking, at least 1 affected customer

Version

Tested in 2021.3.8275

Latest Version

No response

What happened?

"Sequence contains more than one matching element" error when creating a release in the CLI when release versioning set to a referenced package on a step that includes a deployment package

Reproduction

Related to 7283

  1. Create a Run a Script step with Inline source code
  2. Set a Referenced Package
  3. Go to Deployments -> Settings for the Project -> Use the version number from an included package
  4. Select the package from Step 2 above
  5. Go back to the Run a Script step, switch to Script file inside a package, and save
  6. Attempt to create a release from the CLI
    • Example: octo create-release --server=http://Your_Octopus_Server --apikey=API-XXXXXXXXXXXXXXXXXXXXXXXXX --project="project_name"

Error and Stacktrace

System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Octopus.Cli.Commands.Releases.ReleasePlan.GetActionVersionNumber(String packageStepName, String packageReferenceName)
   at Octopus.Cli.Commands.Releases.CreateReleaseCommand.Request()
   at Octopus.Cli.Commands.ApiCommand.Execute()
   at Octopus.Cli.Commands.ApiCommand.Execute(String[] commandLineArguments)
   at Octopus.Cli.CliProgram.Run(String[] args)
Exit code: -3

More Information

No response

Workaround

Create a release via the Octopus Server UI rather than the CLI

or

Create a placeholder step such as the example below: image

image

image

donnybell avatar Feb 07 '22 21:02 donnybell

Unable to reproduce this issue based on the steps provided: image image image

Based on the error message I would have expected multiple packages to have been defined. Do you have a cloud instance up I can test this against?

zentron avatar Feb 08 '22 01:02 zentron

@zentron I fixed the instructions

donnybell avatar Feb 08 '22 14:02 donnybell

Thanks @donnybell , that seems to have helped me reproduce it

zentron avatar Feb 09 '22 11:02 zentron