The following plugin provides functionality available through
Pipeline-compatible steps. Read more about how to integrate steps into your
Pipeline in the
section of the
For a list of other such plugins, see the
Pipeline Steps Reference
Pipeline: Nodes and Processes
node: Allocate node
Allocates an executor on a node (typically a slave) and runs further code in the context of a workspace on that slave.
Computer name, label name, or any other label expression like
linux && 64bit
to restrict where this step builds. May be left blank, in which case any available executor is taken.
The following operators are supported, in descending order of precedence:
parentheses — used to explicitly define the associativity of an expression
NOT — negation; the result of expression must
not be true
a && b
both of the expressions a and b must be true
a || b
either of the expressions a or b may be true
a -> b
"implies" operator — equivalent to !a || b.
For example, windows -> x64 could be thought of as "if a Windows agent is used, then that agent
must be 64-bit", while still allowing this block 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
"if and only if" operator — equivalent to a && b || !a && !b
For example, 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"
- All operators are left-associative, i.e. a -> b -> c is equivalent to (a -> b) -> c.
- Labels or agent names can be surrounded with quotation marks if they contain characters that would conflict with the operator syntax.
For example, "osx (10.11)" || "Windows Server".
- Expressions can be written without whitespace, but including it is recommended for readability; Jenkins will ignore whitespace when evaluating expressions.
- Matching labels or agent names with wildcards or regular expressions is not supported.
- An empty expression will always evaluate to true, matching all agents.
This block may be executed only on the Jenkins master
This block may be executed only on the agent with the name linux-machine-42 (or on any machine that happens to have a label called linux-machine-42)
windows && jdk9
This block may be executed only on any Windows agent that has version 9 of the Java Development Kit installed (assuming that agents with JDK 9 installed have been given a jdk9 label)
postgres && !vm && (linux || freebsd)
This block may be executed only any on Linux or FreeBSD agent, so long as they are
not a virtual machine, and they have PostgreSQL installed (assuming that each agent has the appropriate labels — in particular, each agent running in a virtual machine must have the vm label in order for this example to work as expected)
ws: Allocate workspace
Allocates a workspace. Note that a workspace is automatically allocated for you with the
A workspace is automatically allocated for you with the
node step, or you can get an alternate workspace with this
ws step, but by default the location is chosen automatically. (Something like
You can instead specify a path here and that workspace will be locked instead. (The path may be relative to the slave root, or absolute.)
If concurrent builds ask for the same workspace, a directory with a suffix such as
@2 may be locked instead. Currently there is no option to wait to lock the exact directory requested; if you need to enforce that behavior, you can either fail (
pwd indicates that you got a different directory, or you may enforce serial execution of this part of the build by some other means such as
stage name: '…', concurrency: 1.
If you do not care about locking, just use the
dir step to change current directory.
Was this page helpful?
Please submit your feedback about this page through this
Alternatively, if you don't wish to complete the quick form, you can simply
indicate if you found this page helpful?
See existing feedback here.