You are currently viewing Azure Pipeline Part 10 – Conditions Expressions

Azure Pipeline Part 10 – Conditions Expressions

Azure Pipeline Part 10 – Conditions Expressions

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

Today we are going to discuss how to execute a stage, job or step in Azure Pipeline based on condition. You can use different in-built functions or even a custom expression in your Azure Pipeline condition block.

Azure Pipeline Part 10 – Resources



Azure Pipeline – Conditions

You can specify the conditions under which each stage, job, or step runs. By default, a job or stage runs if it does not depend on any other job or stage, or if all of the jobs or stages that it depends on have completed and succeeded. By default, a step runs if nothing in its job has failed yet and the step immediately preceding it has finished. You can customize this behavior by forcing a stage, job, or step to run even if a previous dependency fails or by specifying a custom condition.

Azure Pipeline – Conditions Syntax:

Azure Pipeline – Conditions Example:

Azure Pipeline – Expression:

Expressions can be used in many places where you need to specify a string, boolean, or number value when authoring a pipeline. The most common use of expressions is in conditions to determine whether a job or step should run.

Another common use of expressions is in defining variables. Expressions can be evaluated at compile time or at run time. Compile time expressions can be used anywhere; runtime expressions can be used in variables and conditions. Runtime expressions are intended as a way to compute the contents of variables and state (example: condition).

Azure Pipeline – Expression Syntax:

Azure Pipeline – Expression Example:

Clean up:

Hope you have enjoyed this article. To know more about Azure DevOps, please refer below official documentation

Leave a Reply