!windows
You can also use the and (&&) and or (!!) operators to combine expressions. For example, suppose the
Postgres database is only tested for Linux. You could tell Jenkins to run a particular build job only on
Linux machines installed with postgres using the following expression:
linux && postgres
Or you could specify that a particular build job is only to be run on a UAT environment in Sydney or
London:
uat && (sydney || london)
If your machine names contain spaces, you will need to enclose them in double quotes:
"Windows 7" || "Windows XP"
There are also two more advanced logical operators that you may find useful. The implies operator
(=>) lets you define a logical constraint of the form “if A is true, then B must also be true.” For example,
suppose you have a build job that can run on any Linux distribution, but if it is executed on a Windows
box, it must be Windows 7. You could express this constraint as follows:
windows -> "Windows 7"
The other logical operator is the if-and-only-if (<=>) operator. This operation lets you define
stronger constraints of the form “If A is true, then B must be true, but if A is false, then B must be false.”
For example, suppose that Windows 7 tests are only to be run in a UAT environment, and that only
Windows 7 tests are to be run in the UAT environment. You could express this as shown here:
"Windows 7" <-> uat
11.5. Node Monitoring
Jenkins doesn’t just dispatch build jobs to slave agents and hope for the best: it pro-actively monitors
your slave machines, and will take a node offline if it considers that the node is incapable of safely
performing a build. You can fine-tune exactly what Jenkins monitors int the Manage Nodes screen (see
Figure 11.16, “Jenkins proactively monitors your build agents”). Jenkins monitors the slave agents in
several different ways. It monitors the response time: an overly slow response time can indicate either a
network problem or that the slave machine is down. It also monitors the amount of disk space, temporary
directory space and swap space available to the Jenkins user on the slave machine, since build jobs can
be notoriously disk-hungry. It also keeps tabs on the system clocks, as if the clocks are not correctly
synchronized, odd errors can sometimes happen. If any of these criteria is not up to scratch, Jenkins will
automatically take the server offline.