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
Functions
Trigger conditions support functions for pattern matching and changeset-based filtering. Functions can be combined with logical operators (&&, ||, !) for advanced matching.
The glob() function
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.
The changesetInclude() function
The changesetInclude() function triggers pipelines based on which files changed in a commit. It returns true if ANY changed file matches ANY of the specified patterns.
Syntax: changesetInclude("pattern1", "pattern2", ...)
patterns: One or more glob patterns to match against changed file paths
Behavior:
Returns
trueif any changed file matches any of the provided patternsReturns
falseif no files match or if there are no changed filesPatterns use glob syntax (same as step-level changeset conditions)
Examples:
Trigger when source files change:
changesetInclude("src/**")Trigger for multiple directories:
changesetInclude("src/**", "lib/**")Combine with branch condition:
BITBUCKET_BRANCH == "main" && changesetInclude("src/**")Use OR logic:
changesetInclude("backend/**") || changesetInclude("shared/**")
The changesetExclude() function
The changesetExclude() function triggers pipelines when changes exist outside of specified patterns. It returns true if at least one changed file does NOT match any of the specified patterns.
Syntax: changesetExclude("pattern1", "pattern2", ...)
patterns: One or more glob patterns to exclude
Behavior:
Returns
trueif any changed file does NOT match any of the provided patternsReturns
falseif all files match the patterns or if there are no changed filesUseful for skipping pipelines when only certain files (like docs) change
Examples:
Skip when only docs change:
changesetExclude("docs/**", "*.md")Run unless only config files changed:
changesetExclude("*.json", "*.yml")Combine with other conditions:
BITBUCKET_BRANCH == "main" && changesetExclude("docs/**")
Was this helpful?