Create release Rest API - incorrect check if release already exists

Hi,

We use the Create Octopus Release Azure Devops package to create and deploy a release.
We pass the option --ignoreexisting, so if a release with the same version, nu further actions are taken.
This was all working correctly until Monday 25/04 where one of our release pipelines failed withe the following error.

Checking for existing release for Operra 41.15.000  because you specified --ignoreExisting...
No release exists - the coast is clear!
Creating release...
There was a problem with your request.
  - Release '41.15.000' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.
Error from Octopus Server (HTTP 400 BadRequest)
Exit code: -7
##[error]"Failed to create release.
The process 'E:\B\1\_tool\octo\9.0.0\x64\octo.exe' failed with exit code 4294967289
Error: The process 'E:\B\1\_tool\octo\9.0.0\x64\octo.exe' failed with exit code 4294967289
    at ExecState._setResult (E:\B\1\_tasks\OctopusCreateRelease_4e131b60-5532-4362-95b6-7c67d9841b4f\5.0.109\node_modules\azure-pipelines-task-lib\toolrunner.js:942:25)
    at ExecState.CheckComplete (E:\B\1\_tasks\OctopusCreateRelease_4e131b60-5532-4362-95b6-7c67d9841b4f\5.0.109\node_modules\azure-pipelines-task-lib\toolrunner.js:925:18)
    at ChildProcess.<anonymous> (E:\B\1\_tasks\OctopusCreateRelease_4e131b60-5532-4362-95b6-7c67d9841b4f\5.0.109\node_modules\azure-pipelines-task-lib\toolrunner.js:838:19)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

I added the debug option to get more information

AzureDevops package version: 5.0.109
Octopus CLI: 8.0.1
Executed command

E:\B\1\_tool\octo\8.0.1\x64\octo.exe create-release --space Spaces-1 --project Projects-161 --releaseNumber "41.15.000 " --channel "Release 41" --enableServiceMessages --progress --deployTo "Agri - Development" --tenant Saipol --server http://industry-tfs-octopus.veibe.net/ --apiKey *** --ignoreSslErrors --waitfordeployment --deploymenttimeout=01:00:00 --package=Operra.Server.Deployment:41.15.0 --package=Operra.Services.Deployment:41.15.0 --package=Operra.Server.Configuration.Deployment:41.15.0 --package=Operra.Client.WPF.Deployment:41.15.0 --package=Operra.Shell.WPF.Deployment:41.15.0 --ignoreexisting --debug

Output

Checking for existing release for Operra 41.15.000  because you specified --ignoreExisting...
GET http://industry-tfs-octopus.veibe.net/api/Spaces-1/projects/Projects-161/releases/41.15.000 
No release exists - the coast is clear!
Creating release...
POST http://industry-tfs-octopus.veibe.net/api/Spaces-1/releases?ignoreChannelRules=False
There was a problem with your request.
 - Release '41.15.000' already exists for this project. Please use a different version, or look at using a mask to auto-increment the number.
Error from Octopus Server (HTTP 400 BadRequest)

When I query the http://industry-tfs-octopus.veibe.net/api/Spaces-1/projects/Projects-161/releases/41.15.000 endpoint I do get a result
41.15.000.json (4.5 KB)

Other release (for other versions) in recent days do detect existing versions correctly.
Any idea what’s going wrong here? Could there be something wrong with that particular 41.15,000 version?

Thx, Remi

Hi Remi,

Thanks for reaching out. To me, this points to an error in logic with regards to the “–ignoreexisting” argument.

Obviously whatever logic “–ignoreexisting” uses, should be identical to the the logic “Create Release” uses when attempting to create the release.

You have performed probably the majority of checks I would’ve asked you to perform in this instance, so I’m going to pass this onto the engineers as it is, for them to have a good look.

Thanks for being so thorough. I’ll keep you updated with any updates.

Regards,

Dane

Hi Remi,

I just realized we are missing one fundamental piece of the puzzle here. What version of Octopus Server are you running?

Regards,

Dane

Hi Dane,

We are using version 2020.1.12 for Octopus Server.
But by rereading the pasted information in my first comment I discovered the problem.

The releaseNumber variable contains a trailing space (–releaseNumber "41.15.000 ")

E:\B\1\_tool\octo\8.0.1\x64\octo.exe create-release --space Spaces-1 --project Projects-161 --releaseNumber "41.15.000 " --channel "Release 41" --enableServiceMessages --progress --deployTo "Agri - Development" --tenant Saipol --server http://industry-tfs-octopus.veibe.net/ --apiKey *** --ignoreSslErrors --waitfordeployment --deploymenttimeout=01:00:00 --package=Operra.Server.Deployment:41.15.0 --package=Operra.Services.Deployment:41.15.0 --package=Operra.Server.Configuration.Deployment:41.15.0 --package=Operra.Client.WPF.Deployment:41.15.0 --package=Operra.Shell.WPF.Deployment:41.15.0 --ignoreexisting --debug

So that’s a problem I will solve on our side.

This does mean that when a release is created a “trim” is done on the version number, which is not done in the –ignoreexisting logic. So that can still be investigated on your side.

So, from my side there is no problem anymore.
Thanks for the help anyway.
Remi

Remi,

Well done, and yes you’re right. That seems logical re the trim.

Happy Deployments.

Regards,

Hi Remi,

I’ve created an issue, in case you want to follow this bug along to a conclusion.

Thank you so much for your help.

Regards,