Skip to content

Commit d5a22b9

Browse files
committed
small edit
1 parent 0b07541 commit d5a22b9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

docs/pipelines/process/run-number.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Run and build numbers
2+
title: Configure run and build numbers
33
description: Learn about Azure Pipelines run numbers and build numbers and how you can configure them in your pipelines.
44
ms.topic: conceptual
55
ms.assetid: 7C469647-117D-4867-B094-8BC811C0003E
@@ -11,6 +11,8 @@ monikerRange: "<=azure-devops"
1111

1212
[!INCLUDE [version-lt-eq-azure-devops](../../includes/version-lt-eq-azure-devops.md)]
1313

14+
Azure Pipelines assigns a unique run number (also called a build number) to each pipeline execution. You can customize these numbers to make them more meaningful for your team, using variables, tokens, and naming patterns.
15+
1416
This article explains how Azure Pipelines build numbers and run numbers are constructed, and how you can customize them in your pipelines.
1517

1618
The run number is used to identify a specific execution of a pipeline or build. The build number is synonymous with the run number.
@@ -19,18 +21,17 @@ If you don't specify a build name in YAML pipelines, or you leave the **Name** f
1921

2022
::: moniker range=">=azure-devops-2020"
2123

22-
In YAML pipelines, the build name property is called `name` and must be at the root level of a pipeline. Items specified at the root level of a YAML file are [pipeline](/azure/devops/pipelines/yaml-schema/pipeline) properties.
24+
You can only customize the run number at the root level of the pipeline with the `name`property. The `name` property is set at the [pipeline](/azure/devops/pipelines/yaml-schema/pipeline) level.
2325

24-
>[!NOTE]
25-
>The `name` property doesn't work in template files.
26+
The `name` property only works at the pipeline root and not in templates or stages.
2627

27-
The following example code outputs a customized build number like **project_def_master_202408281**.
28+
The following example code outputs a customized number like `project_def_main_20240828.1`.
2829

2930
```yaml
3031
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:r)
3132

3233
steps:
33-
- script: echo '$(Build.BuildNumber)'
34+
- script: echo '$(Build.BuildNumber)'
3435
```
3536
3637
::: moniker-end
@@ -87,7 +88,7 @@ The following table shows how each token resolves, based on the previous example
8788
>[!IMPORTANT]
8889
>If you want to show prefix zeros in the run number, you can add more `r` characters to the `Rev` token. For example, specify `$(Rev:rr)` if you want the `Rev` number to begin with `01`, `02`, and so on.
8990
>
90-
>If you use a zero-padded `Rev` as part of a version numbering scheme, be aware that some pipeline tasks or popular tools, like NuGet packages, remove the leading zeros. This behavior causes a version number mismatch in the artifacts that are produced.
91+
>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 are produced.
9192

9293
## Expressions
9394

@@ -154,7 +155,7 @@ steps:
154155

155156
### How can I reference the run number variable within a script?
156157

157-
You can define a new variable that includes the run number, or call the run number directly. In the following example, `$(MyRunNumber)` is a new variable that includes the run number. You can call the run number variable by using `MyRunNumber` or `$(Build.BuildNumber)`.
158+
You can reference the run number directly as `$(Build.BuildNumber)` in your scripts, or create a custom variable that includes it. For example:
158159

159160
```yaml
160161
# Set MyRunNumber

0 commit comments

Comments
 (0)