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:

  • (var_1 > 100 && var_1 <= 200) || var_2 == "ok" && var_3 == true

  • glob(var_1, "feature/*") && var_2 != "ok"

Expression Form

  • Must evaluate to a boolean (true or false).

  • Non-boolean results (e.g., "hello world") are invalid.

Literals

  • String: "text"

  • Number: 42, 3.14

  • Boolean: true, false

  • null: Not supported. Use the string "null" if required (for example, value == "null").

Variables

  • Refer to variables directly by name (no $ prefix).

演算子

  • == — Equality

  • != — Inequality

  • && — Logical AND

  • || — Logical OR

  • ! — Logical NOT

  • () Grouping

  • >, >=, <, <= Comparison operators

関数

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

構文: 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)

動作

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.

例:

  • 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” etc

  • Match 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.

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。