Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure devops - build number vs build id

Documentation says:

Build.BuildId - The ID of the record for the completed build.

Build.BuildNumber - The name of the completed build, also known as the run number and that it can be customized.

Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services

If you create a fresh build pipeline and do not customize BuildNumber format:

it will be given a unique integer as its name

In this case, is BuildNumber and BuildId exactly the same?

like image 672
Aurimas Avatar asked May 11 '21 06:05

Aurimas


People also ask

What is build number in Azure DevOps?

BuildId) is an internal immutable ID that is also referred to as the Run ID. It is unique across the organization. 2 (The third run will be 3, and so on.) Use $(Rev:r) to ensure that every completed build has a unique name.

What is build definition ID?

If you use Visual Studio 2010, in the Team Explorer, select the related build definition, and right click it, and select Properties, there is Url, for example, vstfs:///Build/Definition/2, the number at the end of the Url is the build definition ID.

How do I find my Azure DevOps number?

Azure DevOps ServerOpen the About page from the profile menu as shown in the following image. A page similar to the following image opens showing the version number.

How do I get the build ID of my Azure DevOps project?

If you need a unique ID in your version number, you can use the $ (Build.BuildId) predefined variable . This is an auto-incrementing integer that Azure DevOps increments after any build in your Azure DevOps organization; not just in your specific build pipeline. No two builds created in your Azure DevOps should ever have the same Build ID.

What is the difference between Build id and build number?

For classic build id and number are integers and are the same if not customized. For yml build pipeline and build id is an integer and build number consists of current date and number of tries per day. As per documentation the format is $ (Date:yyyyMMdd).$ (Rev:r).

What is agent scope variable in Azure DevOps?

This variable is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag. The GUID of the TFS collection or Azure DevOps organization.

What is a build number format?

The name (i.e. Build number format) is what shows up on your Azure Pipeline’s build summary page.


Video Answer


2 Answers

No, it's not necessary the same. I just checked my classic and yml pipelines.

For classic build id and number are integers and are the same if not customized.

For yml build pipeline and build id is an integer and build number consists of current date and number of tries per day. As per documentation the format is $(Date:yyyyMMdd).$(Rev:r).

enter image description here

like image 98
Mak Sim Avatar answered Oct 22 '22 07:10

Mak Sim


In this case, is BuildNumber and BuildId exactly the same?

Yes. When you don't customize BuildNumber format, the value of the two variables are the same.

Here is an example:

No define Build number:

enter image description here

output the two variables:

- powershell: |
   echo $(build.buildid)
   
   echo $(build.buildnumber)
  displayName: 'PowerShell Script'

Result: The value is same.

enter image description here

like image 39
Kevin Lu-MSFT Avatar answered Oct 22 '22 08:10

Kevin Lu-MSFT