2
votes

I get so many frustrations with Azure DevOps. In my Build number format I would like to have both

  • A number that restart to 0 when I update my major an minor version.
  • But I also would like to have a real build number that is never reset whatever is my build number format. This build number can also be shared by all my build pipeline of my project. Is it possible?

I'm not using YAML format. I use the classic interfaces with the option page to set my build format. At this moment I have this:

enter image description here

It work except each month the r number restart at 0. I want it to continue.

EDIT

enter image description here

I still didn't decided my final format. I would like to understand all the possibilities. Now I discovered the $(BuildID) property I have another question. Is it possible to have something similar to $(Rev:r) variable but that only check the left part of my build number.

Example:

4.16.$(SequenceFor[4.16]).$(BuildID)

In fact I would like to manually set the Major and Minor version and let the system update one by one the Build and use the Revision for the global $(BuildID).

1
I just found this page docs.microsoft.com/en-us/azure/devops/pipelines/process/…. Thanks to Google because impossible to have it with Bing (sic)… Microsoft. But there is no clear solution on this page. Maybe $(BuildID)?Bastien Vandamme
Do you must include the date in the build number?Shayki Abramczyk
I still didn't decided my final format. I would like to understand all the possibilities.Bastien Vandamme
In fact I have many builds in one DevOps project. All have different major and minor version. I have 2.0.x.y, 3.16.x.y and 4.16.x.y, ... These are version of the same project but I must maintain for compatibility reason. So at the end it is also good to have a number for global comparison. This is my version 2 something but I did the build after my version 4 something.Bastien Vandamme
Please check my answer :)Shayki Abramczyk

1 Answers

3
votes

The $(rev:r) is restarted when the build number changes in any character, so this is the reason why it's restarted whenever the major/minor or the sate changed.

So if you want to use an incremental unique number you can't use the $(rev:r) because then it will be restarted each build.

If you want a number that depends on the major and the minor numbers you need to use the counter expression:

Create 2 variables:

  1. major-minor = 4.16

And a variable that depends on his value and also is a counter:

  1. revision = $[ counter(variables['major-minor'],0) ]

enter image description here

The build number will be:

$(major-minor).$(revision).$(Build.BuildId)

Now, if you will change the major-minor (to 4.17 or 5.16) the revision will be again 0.