Your browser was unable to load all of the resources. They may
have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.
We have a configuration that accepts a variable with a name (lets call is X). This name may be resource name or node name.
We are trying to schedule a build with one of 2 conditions:
- Node with resource == X.getValue()
- Node with hostName == X.getValue()
The problem is, in case we use the node name and there is no resource with this value, the first condition throws exception. We must use an existing resource name although the second condition is valid.
Any idea how we can overcome this issue?
Thanks in advance
Change condition1 to use below script should work:
ResourceManager.instance.get(X.getValue()) != null && node.hasResource(X.getValue());
The resourcemanager is used to check if resource is defined
Thanks for the fast response!
I assume that this script should be in "On node with specified script evaluating to true" condition.
In this case, will it consume the resource?
This is what we currently use (which throws exception in case testResource is a node name and not a resource name)
I see that it failed to upload the image... Will write it as text
- On node matching one of the specified criterias
- On node with specified script evaluating to true
- On node with specified resource
Yes, that is true. The resource is consumed only if the resource exists.
Great! works perfectly.