[JIRA] (JENKINS-50200) Label accepts 2 groovy variables when using && but not || operator

2018-03-27 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer commented on  JENKINS-50200  
 

  
 
 
 
 

 
 
  
 
 
 
 

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

  
 
 
 
 

 
 Well, more accurately, the && case doesn't actually run properly, it just doesn't error out due to being a boolean. It's still bad code - the expected behavior there would be that groovyLabel1 && groovyLabel2 evaluates to a boolean, not to a string, and so shouldn't be valid for node. I remember looking into this a bit before I went on a business trip last week and now I can't remember what I figured out. Grr. I'm pretty sure it was coercion magic doing strange things, but not sure.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-50200) Label accepts 2 groovy variables when using && but not || operator

2018-03-15 Thread atay...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Alex Taylor created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50200  
 
 
  Label accepts 2 groovy variables when using && but not || operator   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 workflow-cps-plugin  
 
 
Created: 
 2018-03-15 17:20  
 
 
Priority: 
  Minor  
 
 
Reporter: 
 Alex Taylor  
 

  
 
 
 
 

 
 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