I am trying to do a very simple file parse operation within a Jenkins 
workflow script and getting some very bizarre results.  This is with the 
workflow 1.1 set of plugins and Jenkins 1.596.  

To demonstrate the issue I created a new workflow job with the following 
script:






*def str="1:one|2:two|3:three"def i = "2"def opts = str.split(/\|/)def opt 
= opts.find { o -> o.contains("${i}:") }echo "len: ${opts.length}"echo 
"opt: ${opt}"*

The output of which is 

>
>
>
>
>
>
> *Started by user anonymous <http://192.168.33.36:8080/user/null>Running: 
> Print Messagelen: 3Running: Print Messageopt: falseRunning: End of 
> WorkflowFinished: SUCCESS*


However, running effectively the same script in the Jenkins script console 
(or any other groovy environment I have tried) produces the expected result:






*def str="1:one|2:two|3:three"def i = "2"def opts = str.split(/\|/)def opt 
= opts.find { o -> o.contains("${i}:") }println "len: 
${opts.length}"println "opt: ${opt}"*

returns:


> *len: 3**opt: 2:two*


Am I missing something really obvious or should I open a bug report for 
this?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5e283cf9-14f3-4fff-9100-c3daacf25bea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to