Expression language
Use Expression Language to build conditional expressions and make your pipelines more flexible.
This document describes a compact and safe boolean expression language designed for evaluating runtime context within pipeline configurations.
Expressions written in this language are evaluated to either true or false. The language supports the use of variables, literals, comparison operators, logical operations, grouping of expressions, and a set of simple functions to enable flexible and precise condition evaluation.
Where is Expression Language used ?
Expression language is currently being used in the following:
Example
(var_1 > 100 && var_1 <= 200) || var_2 == "ok" && var_3 == trueglob(var_1, "feature/*") && var_2 != "ok"
Expression Form
Must evaluate to a boolean (
trueorfalse).Non-boolean results (e.g.,
"hello world") are invalid.
Literals
String:
"text"Number:
42,3.14Boolean:
true,falsenull: Not supported. Use the string"null"if required (for example,value == "null").
Variables
Refer to variables directly by name (no
$prefix).
Operators
==— Equality!=— Inequality&&— Logical AND||— Logical OR!— Logical NOT()— Grouping>,>=,<,<=Comparison operators
Functions
The glob() function enables flexible pattern matching in trigger conditions, allowing you to match branches, tags, or other variables using wildcards and brace expansion. It returns true if the value matches the pattern, and false otherwise.
Syntax and parameters
Syntax: glob(value, "pattern")
value: The variable to test (e.g.,
BITBUCKET_BRANCH,BITBUCKET_TAG)pattern: The glob pattern to match (must be in quotes; supports wildcards like
*,?, and brace expansion{}; patterns are case-sensitive)
Behavior
The glob() function follows the same pattern-matching rules as using glob patterns on the Pipelines yaml file.
You can combine glob() with logical operators (&&, ||, !) in condition expressions for advanced matching.
Examples:
Match feature branches:
glob(BITBUCKET_BRANCH, "feature/*")
Matches any branch that starts with "feature/".Match version tags:
glob(BITBUCKET_TAG, "v1.*")
Matches tags like "v1.0", “v1.1” etcMatch multiple patterns using brace expansion:
glob(BITBUCKET_BRANCH, "{main,develop,staging}")
Matches if the branch is "main", "develop", or "staging".Match all with glob **:
glob(BITBUCKET_BRANCH, "**")
Matches any branch name.
Was this helpful?