If this project should always be built on a specific agent, or on the built-in
node, then you can just enter the agent's name, or built-in
,
respectively.
However, you should generally avoid using the Name of an agent here,
preferring to target the Labels of an agent. As documented on the
configuration page for each agent, and the Configure System page for
the master, labels can be used to represent which operating system the agent
is running on, its CPU architecture, or any number of other characteristics.
Using labels removes the need to re-configure the label expression entered
here each time that you add, remove, or rename agents.
A label expression can be as simple as entering a single label or
agent name, for example android-builder
, or
linux-machine-42
.
You can also make use of various operators to create more complex
expressions.
(expression)
!expression
expression
must not be true
a && b
a
and b
must be
true
a || b
a
or b
may be
true
a -> b
!a || b
.windows -> x64
could be thought of as "if a Windows
agent is used, then that agent must be 64-bit", while still
allowing this project to be executed on any agents that do not have
the windows
label, regardless of whether they have also have an
x64
label
a <-> b
a && b ||
!a && !b
windows <-> dc2
could be thought of as "if a
Windows agent is used, then that agent must be in datacenter 2, but
if a non-Windows agent is used, then it must not be in datacenter
2"
a -> b -> c
is
equivalent to (a -> b) -> c
.
"osx (10.11)" || "Windows Server"
.
built-in
linux-machine-42
linux-machine-42
(or on any machine that happens to have a label
called linux-machine-42
)
windows && jdk9
jdk9
label)
postgres && !vm && (linux || freebsd)
vm
label in order for this example to work as expected)