azureazure-devopscontinuous-integration

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?


Solution

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

    For classic, both BuildId and BuildNumber are integers and are the same if not customized.

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

    'BUILD_BUILDNUMBER' variable value in yml pipeline