Version Template

Hello,

I have a question regarding version templates. This is our current version template:
#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.LastPatch}.#{Octopus.Version.NextRevision}

Our releases are being created by octo.exe. For our dev brache we don’t supply a version number, for our release branch we do. The version number for dev is thereby defined by Octopus. Our dev branch version is for example 10.2.99.x, the version for release is 9.1.1.x. On some point in time the highest release is a dev version. When we create a patch on a release version we create a release version lower then the current version. When we then create a new dev release it wil increment on the release version where we would like to increment on the latest dev version.

So, I’m looking for HighestMajor, HighestMinor and HighestPatch. Do these exist? I couldn’t find these in the documentation.

Kind regards,
Erwin Staal

Hi Erwin,

I have some good news and some bad news.

The bad news is, no, there are no Highest... variables.

The good news is we have a new feature called Channels, which is designed exactly for scenarios such as this. It is currently available in pre-release, but will be available as part of release 3.2 very soon.

You will be able to assign each release a channel (in your case maybe ‘Dev’ and ‘Release’). Then in your version template, you can use:
#{Octopus.Version.Channel.LastMajor}, #{Octopus.Version.Channel.NextBuild}, etc.

I hope this helps,
Michael

Sounds like a great solution! I can supply the branche via octo.exe?

Kind regards,
Erwin

Yes. We added a ‘channel’ parameter to octo.exe when creating releases.

Although there may be no ‘Highest’ variable for each of the version components, what are the values that Octopus will accept in 3.1? 3.2? I’m being called on to modify the version number.

Also, is there a Restful API (or some other API) that I could trigger from a TFS build workflow that would tirgger a release? I’m being asked to have finer control over package and release generation on Octopus.

In particular, I note that NuGet supports SemVer 1.0.0. Does Octopus also support this standard?

The version variables available are:
Octopus.Version.(Last|Next)(Major|Minor|Patch|Build|Revision|Suffix).

In version 3.2 onwards, channels specific variables are also available:
Octopus.Version.Channel.(Last|Next)(Major|Minor|Patch|Build|Revision|Suffix).

You can also use date variables:
Octopus.Date.(Day|Month|Year|DayOfYear)

You can also the semantic version mask characters c and i, which represent the current and incremented values of the version. e.g.
2.1.c.i.

You can see all the options above on the Project Settings page, by clicking ‘Examples’.

Octopus Deploy has a REST API that you can use to create a release. From a TFS pipeline, the easiest way is invoke octo.exe to create the release.

Octopus does support the SemVer 1.0.0 standard.

I hope this helps.
Michael

Thank you. That is what I thought.


John Merryweather Cooper
Senior Software Engineer | Integration Development Group | Enterprise Notification Service
Jack Henry & Associates, Inc.® | Lenexa, KS 66214 | Ext: 431050 |JoCooper@jackhenry.commailto:JoCooper@jackhenry.com

From: Michael Richardson [mailto:tender2+d392b822cf@tenderapp.com]
Sent: Sunday, November 8, 2015 5:57 PM
To: John Cooper JoCooper@jackhenry.com
Subject: Re: Version Template [Questions #6118]

The e-mail below is from an external source. Please do not open attachments or click links from an unknown or suspicious origin.

Is there a way to show the time in this format: 4:05pm instead of 16:05?

I figured out the Id’s from looking at the URI’s in the admin interface. I have a working MSBuild Task interface that assembles a Release based on NuGetPackageId’s and Version custom metadata, and a separate MSBuild Task that takes the resulting Release Id and Deploys it. Although it is very strange to me, I’m getting to like this REST API.

Daniel,
No, the Hour component is only available in 24-hour format.

John,
That’s great! Nice work.

If there is interest, I would be happy to post on my blog how to create these two MSBuild Tasks.