Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Bitbucket
Bitbucket Cloud

Documentation

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 eithertrue orfalse. 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 == true

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

Expression Form

  • Must evaluate to a boolean (true orfalse).

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

Operators

  • == — Equality

  • != — Inequality

  • && — Logical AND

  • || — Logical OR

  • ! — Logical NOT

  • () Grouping

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

Functions

Theglob() function enables flexible pattern matching in trigger conditions, allowing you to match branches, tags, or other variables using wildcards and brace expansion. It returnstrue if the value matches the pattern, andfalse 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

Theglob() function follows the same pattern-matching rules asusing glob patterns on the Pipelines yaml file.

You can combineglob() 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” 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.

Was this helpful?

Still need help?

The Atlassian Community is here for you.

[8]ページ先頭

©2009-2025 Movatter.jp