Re: Build Flow DSL parallel

2013-08-05 Thread Daniel Beck
Read the exception carefully: It's simply a typo in 'paralllel'. Please also 
consider providing a actual, complete, minimal example next time. The syntax 
errors in what you called snippet were a bit confusing.

For reference, the following complete DSL works like a charm ('empty' and 
'empty2' are projects that just run 'sleep 10' or something similar):
-
def myBuild(def b, def skip, def ign) {
if (skip) {
println Skipping +b
} else {
println Building +b
if (ign) {
ignore(FAILURE) {
build(b)
}
} else {
build(b)
}
}
}

parallel (
  { myBuild('empty2', true, false) },
  { myBuild('empty', false, true) },
  { myBuild('empty2', false, false) }
)
-

On 05.08.2013, at 16:39, Bob Bick bb...@netjets.com wrote:

 Hi,
  
 When running a Build Flow DSL with parallel jobs, I am getting the following 
 error message:
  
 ERROR: Failed to run DSL Script
 groovy.lang.MissingMethodException: No signature of method: 
 com.cloudbees.plugins.flow.FlowDelegate.paralllel() is applicable for 
 argument types: (Script1$_executeBuild_closure4, 
 Script1$_executeBuild_closure5) values: 
 [Script1$_executeBuild_closure4@71be63, 
 Script1$_executeBuild_closure5@18a621e]
 Possible solutions: parallel([Lgroovy.lang.Closure;), 
 parallel(java.util.Collection), parallel(java.util.Map)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
 Method)
  at 
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at 
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
  
 I understand why I am getting this error… it makes total sense… but let me 
 explain what I am trying to do…
  
 I encapsulated builds in a method named ‘myBuild’ so that I did not have to 
 repeat DSL logic (i.e. I can skip and ignore steps based on properties).
  
 myBuild(projectMap,releaseBuild) {
 if (projectMap['skip']) {
 println Skipping +projectMap['name']+ +projectMap
 } else {
 println Building +projectMap+ ; releaseBuild=${releaseBuild}
 if (projectMap['ignore']) {
 ignore(FAILURE) {
 build(projectMap['jenkinsProject'], 
 GIT_BRANCH_OR_TAG:projectMap['branch'], RELEASE_BUILD: releaseBuild)
 }
 } else {
 build(projectMap['jenkinsProject'], 
 GIT_BRANCH_OR_TAG:projectMap['branch'], RELEASE_BUILD: releaseBuild)
 }
 }
 }
  
 Then, my DSL was very simple:
  
 // set up a project Map that specifies whether to ignore failures or skip 
 steps. Also, set up the releseBuild Boolean parameter.
 …
 // Here is a snippet of DSL code that “blows up” with 
 groovy.lang.MissingMethodException
 parallel {
   { myBuild(projectMap[‘project1’],releaseBuild) },
   { myBuild(projectMap[‘project2’],releaseBuild) },
   { myBuild(projectMap[‘project3’],releaseBuild) }
 }
  
 Using my technique, the DSL is concise and very flexible. This is my first 
 time using the Build Flow Plugin so I am wondering whether anyone else had 
 tried to do this type of thing and whether they found a workaround… I know I 
 can get it to work without using the myBuild method; however, if I could make 
 use of that method, it would greatly simplify the DSL and make it much more 
 maintainable.
  
 Any ideas?
  
 Thanks for taking the time to read this.
  
 Bob
 
 *** *** ***
 This message contains information which may be confidential and privileged. 
 Unless you are the addressee (or authorized to receive for the addressee), 
 you may not use, copy or disclose to anyone the message or any information 
 contained in the message. If you have received the message in error,  please 
 advise the sender by reply e-mail and delete the message.
 
 
 -- 
 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.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




RE: Build Flow DSL parallel

2013-08-05 Thread Bob Bick
Thanks.

You are right, it was a typo. I assumed incorrectly that the parallel method 
parameters were of the wrong type.

-Original Message-
From: Daniel Beck [mailto:m...@beckweb.net] 
Sent: Monday, August 05, 2013 2:59 PM
To: jenkinsci-users@googlegroups.com
Cc: Bob Bick
Subject: Re: Build Flow DSL parallel

Read the exception carefully: It's simply a typo in 'paralllel'. Please also 
consider providing a actual, complete, minimal example next time. The syntax 
errors in what you called snippet were a bit confusing.

For reference, the following complete DSL works like a charm ('empty' and 
'empty2' are projects that just run 'sleep 10' or something similar):
-
def myBuild(def b, def skip, def ign) {
if (skip) {
println Skipping +b
} else {
println Building +b
if (ign) {
ignore(FAILURE) {
build(b)
}
} else {
build(b)
}
}
}

parallel (
  { myBuild('empty2', true, false) },
  { myBuild('empty', false, true) },
  { myBuild('empty2', false, false) }
)
-

On 05.08.2013, at 16:39, Bob Bick bb...@netjets.com wrote:

 Hi,
  
 When running a Build Flow DSL with parallel jobs, I am getting the following 
 error message:
  
 ERROR: Failed to run DSL Script
 groovy.lang.MissingMethodException: No signature of method: 
 com.cloudbees.plugins.flow.FlowDelegate.paralllel() is applicable for 
 argument types: (Script1$_executeBuild_closure4, 
 Script1$_executeBuild_closure5) values: 
 [Script1$_executeBuild_closure4@71be63, 
 Script1$_executeBuild_closure5@18a621e]
 Possible solutions: parallel([Lgroovy.lang.Closure;), 
 parallel(java.util.Collection), parallel(java.util.Map)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
 Method)
  at 
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at 
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at 
 java.lang.reflect.Constructor.newInstance(Constructor.java:525)
  
 I understand why I am getting this error... it makes total sense... but 
 let me explain what I am trying to do...
  
 I encapsulated builds in a method named 'myBuild' so that I did not have to 
 repeat DSL logic (i.e. I can skip and ignore steps based on properties).
  
 myBuild(projectMap,releaseBuild) {
 if (projectMap['skip']) {
 println Skipping +projectMap['name']+ +projectMap
 } else {
 println Building +projectMap+ ; releaseBuild=${releaseBuild}
 if (projectMap['ignore']) {
 ignore(FAILURE) {
 build(projectMap['jenkinsProject'], 
 GIT_BRANCH_OR_TAG:projectMap['branch'], RELEASE_BUILD: releaseBuild)
 }
 } else {
 build(projectMap['jenkinsProject'], 
 GIT_BRANCH_OR_TAG:projectMap['branch'], RELEASE_BUILD: releaseBuild)
 }
 }
 }
  
 Then, my DSL was very simple:
  
 // set up a project Map that specifies whether to ignore failures or skip 
 steps. Also, set up the releseBuild Boolean parameter.
 ...
 // Here is a snippet of DSL code that blows up with 
 groovy.lang.MissingMethodException
 parallel {
   { myBuild(projectMap['project1'],releaseBuild) },
   { myBuild(projectMap['project2'],releaseBuild) },
   { myBuild(projectMap['project3'],releaseBuild) } }
  
 Using my technique, the DSL is concise and very flexible. This is my first 
 time using the Build Flow Plugin so I am wondering whether anyone else had 
 tried to do this type of thing and whether they found a workaround... I know 
 I can get it to work without using the myBuild method; however, if I could 
 make use of that method, it would greatly simplify the DSL and make it much 
 more maintainable.
  
 Any ideas?
  
 Thanks for taking the time to read this.
  
 Bob
 
 *** *** ***
 This message contains information which may be confidential and privileged. 
 Unless you are the addressee (or authorized to receive for the addressee), 
 you may not use, copy or disclose to anyone the message or any information 
 contained in the message. If you have received the message in error,  please 
 advise the sender by reply e-mail and delete the message.
 
 
 --
 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.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  


*** *** ***
This message contains information which may be confidential and privileged. 
Unless you are the addressee (or authorized to receive for the addressee), you 
may not use, copy or disclose to anyone the message or any information 
contained in the message. If you have received the message in error,  please 
advise the sender by reply e-mail and delete the message.

-- 
You received this message because you are subscribed