Need Release Versioning Suggestion

aswinraaj.rajasekaran's Avatar

aswinraaj.rajasekaran

30 Nov, 2017 06:44 PM

HI ,
I would like to version my releases based on the following format (YYYY.MMdd.IncrementalVersion) . I tried using #{Octopus.Date.Year}.#{Octopus.Date.Month}#{Octopus.Date.Day}.#{Octopus.Version.NextPatch}
But here, the next patch version should reset back to 0 at the next day instead of using the same incremental patch of the previous day. Please let me know if it is possible to achieve this.

  1. Support Staff 1 Posted by Kenneth Bates on 01 Dec, 2017 05:59 AM

    Kenneth Bates's Avatar

    Hi,

    Thanks for getting in touch!

    I believe something like this should be possible as you can use conditions in the release versioning template using the syntax #{if condition}Statement#{/if}. It may be easier if you split the day from the month in your minor versioning, to be instead something like YYYY.MM.dd.IncrementalVersion to simplify the condition. If you do that, perhaps something like the following would do the trick?

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

    Theoretically you could maybe alter something like this to keep your versioning in the same format as you've mentioned, however. I'd like to hear how you go with that (you may need to tweak it)! Don't hesitate to reach out if you have any further questions as well. :)

    Kind regards,

    Kenny

  2. 2 Posted by aswinraaj.rajas... on 05 Dec, 2017 08:49 AM

    aswinraaj.rajasekaran's Avatar

    HI Kenny,
    Thanks for the reply. I tried the above script.
    Here the script works fine for the first day. but the next day the patch version does not reset to 0.

    I created a release yesterday - 2017.12.04.6
    Today my expectation was that the release number would be 2017.12.05.1 but it ended up being 2017.12.05.7 . Can you please help?

  3. 3 Posted by aswinraaj.rajas... on 06 Dec, 2017 06:01 PM

    aswinraaj.rajasekaran's Avatar

    Kenny! Need your help on this please!

  4. Support Staff 4 Posted by Kenneth Bates on 07 Dec, 2017 04:15 AM

    Kenneth Bates's Avatar

    Hi,

    Thanks for following up! Sorry to hear you're still hitting this issue. I was confident that would work, but when I tested it today it looks like it in fact doesn't. I'm terribly sorry about that. After some further researching into it, it looks like conditions for version templates only support variables being true or false only. i.e. #{if Var} where the project variable named Var has a value of true or false.

    You can use the Use the version number from an included package option in your release versioning strategy. This would be a great solution if you're naming your package after the same versioning scheme as you're wanting to name your releases in Octopus. Would that for your current setup?

    Otherwise, you can still have the patch or revision to auto-increment, but you would need to manually reset to 0 upon the first release of each day.

    I'm sorry about giving you this bad news and for giving you incorrect information earlier!

    Let me know if you have any further questions.

    Kind regards,

    Kenny

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac