A Build Variable Filtering Task lets you conditionally execute subsequent tasks depending on build variables.

As there can be multiple repositories for a plan, there is not necessarily one branch. There could be many branches. planRepository.1.branch means "the branch for the first repository".

To create a build variable expression task, follow these steps:

  1. Enter the build variable expression in Expression.

    You can use a simple expression to check if a build variable has a particular value or more complex expressions where you can use boolean logic.

    The expression is evaluated as a Groovy script however for security reasons you are restricted to simple operations on build variables only. This means that only build variable names that are valid groovy variable names can be used. For build variables that don’t fit this pattern, you can access them as vars[variable.name]. For example, vars["planRepository.1.branch"].

    If the script returns true, or a truthy value, the subsequent tasks are executed. If not, they are skipped.

    Further examples can be found by clicking Show Snippets underneath the expression text.

  2. Enter how many tasks execute if the condition is true in Execute Task.