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
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Run and build numbers
3
3
description: Learn about Azure Pipelines run numbers and build numbers and how you can configure them in your pipelines.
4
4
ms.topic: conceptual
5
5
ms.assetid: 7C469647-117D-4867-B094-8BC811C0003E
6
-
ms.date: 08/11/2025
6
+
ms.date: 08/12/2025
7
7
monikerRange: "<=azure-devops"
8
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.
A unique run number or build number identifies each execution of an Azure Pipelines pipeline or build. This article explains the structure of this number and how you can customize it to be more useful or meaningful for your team.
16
16
17
-
If you don't specify a build name in YAML pipelines, or you leave the **Name** or **Build number format** field blank in Classic pipelines, each run gets a unique integer as its name. Build names can also use a combination of tokens, variables, and other characters. You can customize run and build numbers by using naming patterns, tokens, and variables.
17
+
If you don't specify a build name in YAML pipelines, or you leave the **Name** or **Build number format** field blank in Classic pipelines, each run gets a unique integer as its name. Build names can use other characters, tokens, and variables. You can customize run and build numbers by using naming patterns, special tokens, and predefined or user-defined variables.
18
18
19
19
## Build number configuration
20
20
21
-
In Classic pipelines, you can customize the **Build number format** under **Options** in the pipeline definition. In YAML pipelines, you can customize the run number by using the `name` property at the [pipeline](/azure/devops/pipelines/yaml-schema/pipeline) level of the YAML pipeline definition. The `name` property isn't supported in templates or stages.
21
+
In Classic pipelines, you can customize the **Build number format** under **Options** in the pipeline definition. In YAML pipelines, you can customize the run number format by using the `name` property at the [pipeline](/azure/devops/pipelines/yaml-schema/pipeline) level of the YAML file. The `name` property isn't supported in templates or stages.
22
22
23
-
The following YAML pipeline example sets a custom run number format that produces a name like **MyProject_MyBuild_main_20240828.1**:
23
+
The following example sets a custom run number format that produces a build number like **MyProject_MyBuild_main_20240828.1**.
The default value for an Azure Pipelines run number is `$(Date:yyyyMMdd).$(Rev:r)`. The `$(Rev:r)` is a special variable that works only in the build number field. When a build completes, if nothing else in the build number changed, the `Rev` integer value increases by one.
34
+
The default value for an Azure Pipelines run number is `$(Date:yyyyMMdd).$(Rev:r)`. The `$(Rev:r)` revision variable works only in a build number field. When a build completes, if nothing else in the build number changes, the `Rev` integer value increases by one.
35
35
36
36
`$(Rev:r)`resets to `1` when any other part of the build number changes. For example, if you configure your build number format as `$(Build.DefinitionName)_$(Date:yyyyMMdd).$(Rev:r)`, the build number resets when the date changes.
37
37
38
38
If the previous build number was **MyBuild_20230621.1**, the next build number that day is **MyBuild_20230621.2**. The first build number the next day is **MyBuild_20230622.1**.
39
39
40
40
`$(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**.
41
41
42
-
In the following example, the second run on May 6, 2024 is named **Fabrikam_CIBuild_main_20240506.2**.
42
+
The following build number format produces the name **Fabrikam_CIBuild_main_20240506.2** for the second run on May 6, 2024.
@@ -67,7 +67,7 @@ The following table shows how run number tokens resolve. You can use these token
67
67
| `$(Hours)` | 21 ||
68
68
| `$(Minutes)` | 7 ||
69
69
| `$(Month)` | 5 ||
70
-
| `$(Rev:r)` | 2 | Number of runs that day. Use `$(Rev:r)` to ensure that every completed build has a unique name. |
70
+
| `$(Rev:r)` | 2 | Position in the number of runs that day. Use `$(Rev:r)` to ensure that every completed build has a unique name. |
71
71
| `$(Seconds)` | 3 ||
72
72
| `$(SourceBranchName)` | main ||
73
73
| `$(TeamProject)` | Fabrikam ||
@@ -81,7 +81,7 @@ The following table shows how run number tokens resolve. You can use these token
81
81
82
82
### Expressions in run numbers
83
83
84
-
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.
84
+
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 yet at the time pipeline expressions are evaluated.
0 commit comments