Release Versioning with Automatic Release Creation

Hello.

I’ve been playing around trying to get one of the documented release versioning expressions (https://octopus.com/docs/releases/release-versioning) working with automatic release creation.

I am using the expression at the very bottom of the page #{Octopus.Date.Year}.#{Octopus.Date.Month}.#{Octopus.Date.Day}.i. This is working perfectly when I create a release manually in Octopus; for example today it has created 2021.04.22.2.

When I enable the automatic release creation trigger, it successfully fires when a package is uploaded to the Octopus feed, however the release version has failed to generate properly. It generates 2021.04.22.i - it hasn’t replaced the i with the incremental number.

If I push a new version of the package a second time, I get an error in the Octopus server logs:

Unable to automatically create a release for project ‘XX’ when package XX version 31 was pushed to the built in feed for space Default as the versioning strategy resulted in a release version that already exists

Presumably it’s tried to create a release with the version 2021.04.22.i, which does indeed already exist.

Is there something I am missing here?

Thanks in advance!

Hi @chris.obrien,

Thank you for contacting Octopus Support.

Could you tell me what version of Octopus Server you are currently running? I would like to recreate this in a test environment to confirm this behavior.

Let me know at your earliest convenience.

Regards,
Donny

Hi Chris,

Jumping in here for Donny as he’s off the clock, and I’ve actually hit this issue myself in the recent past. :slight_smile:

This is actually a current known issue that I’ll paste a link to below for you to track.

The workaround is to instead use the #{} syntax instead of i, which is because when releases are created automatically, the version resolves in a different place than where the i masking code is. This alternative is outlined in this doc section.

Sorry for the inconvenience and confusion caused here. Let us know how you go, or if you have any further questions. :slight_smile:

Best regards,

Kenny

Hi both.

Thanks very much for the prompt replies. I’ve tried using the #{} syntax from the documentation as suggested. It appears to be running, but with some expected results.

I’ve pasted the expression inline into this box.

#{Octopus.Date.Year}.#{Octopus.Date.Month}.#{Octopus.Date.Day}. #{if Octopus.Date.Day==Octopus.Version.LastPatch} #{Octopus.Version.NextRevision} #{else} #{if Octopus.Version.LastRevision!=0} 0 #{else} #{Octopus.Version.NextRevision} #{/if}#{/if}

A release is triggering but it’s erroring and failing to complete.

Unable to automatically create a release for project ‘XX’ when package XX version 32 was pushed to the built in feed for space Default: The release number '2021.04.23. 0 ’ does not appear to be a valid semantic version number. The version must consist of between 1 and 4 number only parts before the optional pre-release part. e.g. 2, 2.1, 2.4.0.23, 2.4-beta and 1-beta.2

I presume it’s erroring on the whitespace before the incremental number (it’s added 3 spaces before the ‘0’). I’ve played around with the expression by removing the whitespace around the ‘0’ but it doesn’t seem to have an affect.

I’m running Octopus v2020.6 (Build 4788) if that helps.

Do you have any thoughts on why this might be happening?

Thanks

Apologies, removing the whitespace around the ‘0’ in the expression DOES have the effect of removing a single whitespace character from the version number, however there are still 2 whitespace characters inserted in the version number.

image

Hi @chris.obrien,

Thank you for getting back to us.

Could you provide your current version template after removing the whitespace?

Let me know at your earliest convenience.

Regards,
Donny

Hi Donny

This is the version template I’m using now.

#{Octopus.Date.Year}.#{Octopus.Date.Month}.#{Octopus.Date.Day}. #{if Octopus.Date.Day==Octopus.Version.LastPatch} #{Octopus.Version.NextRevision} #{else} #{if Octopus.Version.LastRevision!=0}0#{else} #{Octopus.Version.NextRevision} #{/if}#{/if}

Thanks

Chris

Hi Donny

The moment I pasted that into here, I spotted the whitespace in the template itself.

I removed it and that’s fixed it. Thanks very much for your help.

Regards

Chris

1 Like

Hi @chris.obrien,

Thank you for the quick response. I’m glad to hear you got it working.

If there is anything else we can assist with, please let us know.

Regards,
Donny

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