Jenkins Job Label Expression: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Jenkins Concepts =Overview= Defines a logical expression which determines which agents may exe...")
 
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
=Overview=
=Overview=


Defines a logical expression which determines which [[Jenkins Concepts#Agent|agents]] may execute builds for a project. This expression, when tested against the 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.
Defines a logical expression which determines which [[Jenkins Concepts#Agent|agents]] may execute builds for a project. This expression, when tested against the ''agent name'' and ''[[Jenkins Concepts#Label|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

Latest revision as of 21:23, 23 April 2018

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