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/conditions.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Pipeline conditions
3
3
description: Learn about conditions that Azure Pipelines stages, jobs, or steps can run under, and ways to specify those conditions.
4
4
ms.topic: conceptual
5
5
ms.assetid: C79149CC-6E0D-4A39-B8D1-EB36C8D3AB89
6
-
ms.date: 07/31/2025
6
+
ms.date: 08/01/2025
7
7
monikerRange: '<= azure-devops'
8
8
#customer intent: As an Azure Pipelines user, I want to understand the conditions that pipeline stages, jobs, and steps can run under, so I can configure builds to run under various conditions.
9
9
---
@@ -34,7 +34,9 @@ You can override or customize these default behaviors by setting a stage, job, o
34
34
35
35
The following YAML example demonstrates the `always()` and `failed()` conditions. The first script task in job 1 has an `always` condition, so it runs even if dependencies fail or the build is canceled. In the second script task, `exit job1` forces the `job1` job to fail.
36
36
37
-
Stages run sequentially, but jobs can run in parallel. To set a condition that depends on the outcome of another job, use `dependsOn`. In the following example, `job2` depends on `job1` and runs because `job1` fails.
37
+
Pipeline stages run sequentially by default, but jobs can run in parallel. You can use the `dependsOn` property to explicitly define dependencies between stages or jobs.
38
+
39
+
To set the conditions for a job that depends on the outcome of another job, use `dependsOn` to define the dependency. In the following example, `job2` depends on `job1` and runs because `job1` fails.
38
40
39
41
```yaml
40
42
jobs:
@@ -50,6 +52,9 @@ jobs:
50
52
condition: failed() # this job runs only if job1 fails
51
53
```
52
54
55
+
> [!NOTE]
56
+
> You can also use the Azure Pipelines UI to manually run dependent stages when the parent stage fails. For more information, see [Run children stages when parent stage fails](../../release-notes/2024/pipelines/sprint-246-update.md#run-children-stages-when-parent-stage-fails).
57
+
53
58
## Custom conditions
54
59
55
60
If the built-in conditions don't meet your needs, you can specify custom conditions as [expressions](expressions.md) in YAML pipeline definitions.
@@ -299,7 +304,7 @@ steps:
299
304
300
305
You can use parameters in conditions. Parameter expansion happens before the pipeline runs and replaces values surrounded by `${{ }}` with the literal parameter values. Because parameter expansion occurs before condition evaluation, you can declare a parameter in a pipeline and embed the parameter inside any condition in that pipeline.
301
306
302
-
The `condition` in the following example combines two functions: `succeeded()`and `${{ eq(parameters.doThing, true) }}`. The `succeeded()` function checks if the previous step succeeded. This function returns `true` if there is no previous step.
307
+
The `condition` in the following example combines two functions: `succeeded()`and `${{ eq(parameters.doThing, true) }}`. The `succeeded()` function checks if the previous step succeeded. This function also returns `true` if there is no previous step.
303
308
304
309
The `${{ eq(parameters.doThing, true) }}` function checks whether the `doThing` parameter is equal to `true`. The script step in the following example runs because there was no previous step and `parameters.doThing` is `true` by default.
0 commit comments