Re: Pipelines, iterating maps and more headaches

2016-04-28 Thread Jesse Glick
On Wed, Apr 27, 2016 at 6:00 PM, Norbert Lange wrote: > node { > > for (it2 in mapToList(depmap)) { > name = it2[0] > revision = it2[1] > } > } > @NonCPS > def mapToList(depmap) { > def dlist = [] > for (entry in depmap) { > dlist.add([entry.key, en

Re: Pipelines, iterating maps and more headaches

2016-04-28 Thread Jesse Glick
On Thu, Apr 28, 2016 at 3:48 AM, Norbert Lange wrote: > the replay feature isnt mentioned in any of the documents from > https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin, you should > really mention it there to get people using it Pipeline documentation in general is in a state of limb

Re: Pipelines, iterating maps and more headaches

2016-04-28 Thread Norbert Lange
Nope, I initially used groovysh for rapid testing, until I found out good Groovy in Groovy is not necessarily good Groovy in Jenkins. Then I created a job with a Pipeline Script an ran that violently. AFAIK, the replay feature isnt mentioned in any of the documents from https://wiki.jenkins-ci.o

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Craig Rodrigues
Norm, Take a look at this my posting from a few months ago: https://groups.google.com/d/msg/jenkinsci-users/P7VMQQuMdsY/bHfBDSn9GgAJ That link has pointers to the Groovy Script class and Groovy shell. I think understanding those two classes will help improve your understanding of Pipeline script

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Brian Ray
Unless you're talking about your method declaration *def mapToList()*. In that case, the def is just window dressing AFAIK. The return type is the same with or without *def*: ie, *Object*. On Wednesday, April 27, 2016 at 3:34:24 PM UTC-7, Brian Ray wrote: > > Nice hackaround. I will try that in

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Patrick Wolf
Did make use of the "Replay" feature at all to troubleshoot your script, Norbert? Just curious. https://jenkins.io/blog/2016/04/14/replay-with-pipeline/ On Wed, Apr 27, 2016 at 3:34 PM, Brian Ray wrote: > Nice hackaround. I will try that in the uncooperative parts of my script. > > Ah yes, *d

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Brian Ray
Nice hackaround. I will try that in the uncooperative parts of my script. Ah yes, *def x* vs *x*. On the face of it the two declarations should be identical--roughly typing *x* as an *Object*. But there are different scoping implications

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Norbert Lange
Hi Brian, every single method in the "final foo" - including the String Constructor requires approval. I was hoping for a proper subset that would work within the sandbox. What I ended with (several dozen "Builds" later ) is using a helper function squeezing the map into a list, seems the m

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Brian Ray
Side note: The map keys and values are simply *String*s. On Wednesday, April 27, 2016 at 9:26:51 AM UTC-7, Brian Ray wrote: > > FWIW I recently replaced several C-style loops with *for ( x in y )* for > iterating over both lists and maps in CPS code and for the most part > conversion went fine.

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Brian Ray
FWIW I recently replaced several C-style loops with *for ( x in y )* for iterating over both lists and maps in CPS code and for the most part conversion went fine. There were a couple of CPS sections where I could not use that construct and had to fall back on the C-loops and further do a tortu

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Norbert Lange
Am Mittwoch, 27. April 2016 16:41:40 UTC+2 schrieb Jesse Glick: > > 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 withou

Re: Pipelines, iterating maps and more headaches

2016-04-27 Thread Jesse Glick
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?

Pipelines, iterating maps and more headaches

2016-04-26 Thread Norbert Lange
Hello, I trying to get comfortable with Pipelines, so far its a rather unpleasant experience since I cant even get a simple script going. 1) 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