You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pipelines/process/run-number.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ ms.topic: conceptual
5
5
ms.assetid: 7C469647-117D-4867-B094-8BC811C0003E
6
6
ms.date: 08/11/2025
7
7
monikerRange: "<=azure-devops"
8
+
#customer intent: As an Azure Pipelines customer, I want to understand the composition of run numbers so I can customize them to be more meaningful and useful for my team.
8
9
---
9
10
10
11
# Run and build numbers
@@ -13,7 +14,7 @@ monikerRange: "<=azure-devops"
13
14
14
15
Azure Pipelines assigns a unique run number, also called a build number, to identify each execution of a pipeline or build. This article explains the structure of these numbers and how you can customize them to be more meaningful for your team.
15
16
16
-
If you don't specify a build name in YAML pipelines, or you leave the **Build number format** field blank in Classic pipelines, each run gets a unique integer as its name. You can use a combination of naming patterns, tokens, and variables to give runs more useful names.
17
+
If you don't specify a build name in YAML pipelines, or you leave the **Build number format** field blank in Classic pipelines, each run gets a unique integer as its name. Build names can use a combination of tokens, variables, and underscore characters. You can use naming patterns, tokens, and variables to give runs more useful names.
17
18
18
19
::: moniker range=">=azure-devops-2020"
19
20
@@ -42,18 +43,21 @@ If the previous build number was **MyBuild_20230621.1**, the next build number t
42
43
43
44
`$(Rev:r)`also resets to `1` if you change the version. If your build format is `1.0.$(Rev:r)` and your last build number was **1.0.3**, if you change the version to `1.1.$(Rev:r)`, the next build number is **1.1.1**.
44
45
45
-
For example, if you specify the build number format `$(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd).$(Rev:r)`, the second run on May 6, 2024 is named **Fabrikam_CIBuild_main_20240506.2**.
46
+
For example, if you specify the following build number format, the second run on May 6, 2024 is named **Fabrikam_CIBuild_main_20240506.2**.
The following table shows how run number tokens resolve. You can use these tokens only to define run numbers. They don't work anywhere else in a pipeline.
59
63
@@ -79,13 +83,13 @@ The following table shows how run number tokens resolve. You can use these token
79
83
>
80
84
>However, if you use a zero-padded `Rev` as part of a version numbering scheme, some pipeline tasks or popular tools like NuGet packages remove the leading zeros. This behavior causes a version number mismatch in the artifacts that the build produces.
81
85
82
-
### Expressions
86
+
### Expressions in run numbers
83
87
84
-
If you use an expression to set the build number, you can't use `$(Build.BuildId)`, `$(Build.BuildUri)`, or `$(Build.BuildNumber)` tokens, because their values aren't set at the time pipeline expressions are evaluated.
88
+
If you use an expression to set the run number, you can't use the `$(Build.BuildId)`, `$(Build.BuildUri)`, or `$(Build.BuildNumber)` tokens, because their values aren't set at the time pipeline expressions are evaluated.
85
89
86
-
### Variables
90
+
### Variables in run numbers
87
91
88
-
You can use both predefined and user-defined variables in your build number. For example, if you define `My.Variable`, you can specify the following number format. The first four variables are predefined.
92
+
You can use both predefined and user-defined variables in your run number. For example, if you define `My.Variable`, you can specify the following number format. The first four variables are predefined.
0 commit comments