Jenkins Job Label Expression

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

Defines a logical expression which determines which agents may execute builds for a project. This expression, when tested against the agent name and labels of each available agent, will be either true or false. If the expression evaluates to true, then that agent will be allowed to execute builds of this project.

In general, using the agent names should be avoided. Labels should be used instead. Using labels removes the need to re-configure the label expression entered here each time that you add, remove, or rename agents.

Operators

Specified in the descending order of precedence:

(expression) - defines the associativity of the expression.

!expression - negation.

a && b - AND, both expressions must true.

a || b - OR, either of the expression a or b may be true.

a -> b - "implies" operator, equivalent with !a || b. For example if "linux -> x64" expression is used, it is interpreted as follows: if a Linux agent is used, then the agent must be 64 bit.

a <-> b - "if and only if" operator, equivalent to a && b || !a && !b