| What I think is happening is the following. Given the lazy evaluation of actual arguments intrinsic to Groovy, the groovy interpreter first tries to obtain all the actual arguments before calling the function. As part of that process it runs the node() step. Since podTemplate(label: 'postgres', ...) hasn't been called yet, there is no node with that label, and the node() step blocks indefinitely trying to get hold of such a node. Notice the interpreter can't detect the wrong argument type in the call to podTemplate() since it first needs to evaluate the node() step. This kind of issues are catched by the compiler in a type-safe language. If the node() step gave up and returned, the interpreter would catch the wrong argument type and the call to podTemplate() would fail. |