CLI Package Prerelease Selecting Wrong Packages

Semver dictates that multiple hyphens in a prerelease identifier are allowed. However, Octopus seems to not handle this correctly.

Consider the case where we have some package versions as follows:
1.0.0-hello
1.0.1-hello-world

If we tell octopus to create a release with a prerelease identifier of “hello” then it would select version 1.0.1-hello-world

We are experiencing this very issue right now. Just want to confirm if this is a known bug or if we’re doing something wrong? We’re creating the release through the CLI with “–packageprerelease” flag. We have no channel version filters in place.

Hey Andrew,

Thanks for reaching out and welcome to the Octopus Forums.

I’ve tested this on my side in latest on both CLI and Octopus and see the same behavior.

Are you currently blocked by this or do you have a workaround that works for your pipeline?

Please let me know.

Best,
Jeremy

Thanks for confirming Jeremy.

We are unfortunately a bit blocked by this at the moment on some of our development environments. Any suggestions on workarounds? If possible I would like to avoid having to add version rules in a lot of places which is why I opted to use the prerelease identifiers instead.

Hey Andrew,

You’re very welcome.

I’ve created a github issue you can follow here:https://github.com/OctopusDeploy/Issues/issues/7048

Unfortunately, I can’t think of any workarounds that won’t have a bit of work to implement. I am asking some colleagues if they have an elegant solution.

Can I ask, how are you creating the release? Is it at the end of a pipeline? If so, which build server are you using? Is only one project affected so far?

Please let me know.

Best,
Jeremy

Hey Andrew,

One of my colleagues asked if you could potentially use an API call in the meantime to create the release rather than the octo cli.

Is that a possibility for your use case?

Here is an example API call that you could adapt: https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/REST/PowerShell/Releases/CreateRelease.ps1

Please let me know.

Best,
Jeremy

Hey Andrew,

In case you didnt subscribe to that GitHub issue yet, the integrations team updated it to let me know that the parameter supports regex so you would want to put a $ at the end of the string. e.g, hello$. We are going to update the documentation to call this out.

Please let me know if that gets you unstuck.

Best,
Jeremy

1 Like

Hey Jeremy,

Sorry for dropping off on this, I had to run out earlier. I appreciate your help here and was getting ready to try the API approach, but will definitely try with regex first.

Hey Jeremy,

Just wanted to follow up here and let you know regex saved the day. Although your suggestion of just using the end of expression character didn’t work for us because we also append some metadata after the prerelease identifier with a + separator. I modified the regex to support both cases: ($|\+).

Thanks very much for your extremely fast help with this, much appreciated.

1 Like

Hey Andrew,

Thanks for the update! You’re very welcome.

Let us know if you run into any other issues going forward. I hope you have a great rest of your week.

Best,
Jeremy

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.