On Tuesday, April 26, 2016 at 7:18:55 PM UTC-4, Norbert Lange wrote:
>
> There seem to be some arcane rules on how to iterate over some 
> builtin Groovy/Java Types within a sandbox. I haven`t found a way that 
> works without manually allowing the function.


Which methods did you need to approve? We can easily add them to the 
default whitelist in the Script Security plugin. But anyway


> 2) Serialization issues for iterators. 
>

`for (x : list) {…}` works as of `workflow-cps` 2.x. Other iterators do not 
yet work (outside a `@NonCPS` method). Probably fixing them is not hard, 
just have not gotten to it yet.
 

>
> take the createDList 
> which seems to execute the code differently (throws errrors, need to 
> define a explicit variable)
>

Not sure what this is about. If you find something you think should work 
which does not work in a minimal reproducible script, please file a bug 
report for it.
 

>
> Are variables from Closures global?
>

Local `def` variables in a closure? Not sure what you are referring to here.

The main problem you are presumably hitting is the well-known JENKINS-26481 
<https://issues.jenkins-ci.org/browse/JENKINS-26481>. We are working on a 
fix, but in the meantime, do not use any method built into Groovy which 
takes a closure argument, such as `list.each {x -> …}` or 
`someText.eachLine {line -> …}`. Rather use a Java-style loop. (To be on 
the safe side, also avoid iterators, meaning use a C- or JDK 1.4-style loop 
with an index.)

Incidentally `it` does not currently work in closures as noted in 
JENKINS-33468 <https://issues.jenkins-ci.org/browse/JENKINS-33468>; use an 
explicit parameter name instead.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/02dfacb5-935b-433e-aa75-e58cff069163%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to