Label accepts 2 groovy variables when using && but not || operator

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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"
      }
      

       

            Assignee:
            Unassigned
            Reporter:
            Alex Taylor
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: