I have a Jenkins pipeline like:
node("slave1"){
echo "Building very very complicated things"
}
If the node "slave1" does not exist in my Jenkins setup, the build is stuck forever.
I know I could use timeout keyword and wrap the node command. However, this is not good since timeout can happen because of inexistent node or long-taking build. That's not really a solution.
Any calls that I can do to check if a node exists or not?
I understand I can use timeout and wrap something like this : node("slave1"){echo "Hello"} . That way I can test if node exists. However, this actually makes a connection to the node (in my case, spawns a container in OpenShift/Kubernetes and wastes it immediately)
I use Jenkins 2.32.2 and pipeline plugin version 2.1.