-
Bug
-
Resolution: Unresolved
-
Minor
-
None
When running a pipeline, the label expects a string with the option of an operator. Apparently the && operator with 2 groovy variables will evaluate correctly but not a || operator.
So this pipeline runs correctly:
def groovyLabel1 = 'master' def groovyLabel2 = 'TestAgent' node(groovyLabel1 && groovyLabel2){ echo "hello" }
But this code does not run correctly:
def groovyLabel1 = 'master' def groovyLabel2 = 'TestAgent' node(groovyLabel1 || groovyLabel2){ echo "hello" }
because it fails with this error:
java.lang.ClassCastException: org.jenkinsci.plugins.workflow.support.steps.ExecutorStep.label expects class java.lang.String but received class java.lang.Boolean
I think that groovy is doing some funky parsing here and causing the error because what should be the only thing allowed would be something like this:
node('master || TestAgent'){ echo "hello" }