You can specify a groovy expression to be evaluated each time a resource is checked to be appropriate for a build. The expression must result into a boolean value. The following variables are available, in addition to optional arguments of the currently evaluated build:

resourceName
as per resource configuration
resourceDescription
as per resource configuration
resourceLabels
java.util.List<String> of labels as per resource configuration

For matrix jobs, axis names and axis values can be referenced as well. Examples:

The script's contents need to pass approval by the Script Security Plugin.