Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I control my build number with Azure DevOps?

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).

like image 656
Bastien Vandamme Avatar asked Oct 19 '25 01:10

Bastien Vandamme


1 Answers

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 date 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.

like image 55
Shayki Abramczyk Avatar answered Oct 22 '25 08:10

Shayki Abramczyk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!