Re: Spawn multiple jobs

2016-12-13 Thread Bryce Pepper
That is correct, I found this post -- 
 
https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/jobs-in-parallel/jobs_in_parallel.groovy


On Tuesday, December 13, 2016 at 8:37:34 AM UTC-6, Daniel Beck wrote:
>
>
> > On 13.12.2016, at 15:32, Bryce Pepper > 
> wrote: 
> > 
> > The following works as a Build Flow, I tried as a Pipeline but didn't 
> have any luck. 
>
> In this case you're defining a new variable (inputParameter) inside each 
> loop iteration that you pass as argument into build(…). I haven't tried it, 
> but this may well be the relevant difference between the two scripts you 
> showed. 
>
>

-- 
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/5e5c96a3--4e14-93d4-0faf31cab84d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spawn multiple jobs

2016-12-13 Thread Bryce Pepper
Thanks for the extra set of eyes and the tip (sorry my java skills are a 
bit rusty). The following works as a Build Flow, I tried as a Pipeline but 
didn't have any luck. As time frees up over the holidays I may revisit. 
 Thanks again.

def parm = build.buildVariableResolver.resolve("inputParameter").split(/[ 
,]+/)
def jobs = [:]

for (String deployment : parm) {
  def inputParameter = deployment
  
  jobs[inputParameter] = {
build( 'aa', inputParameter: "${inputParameter}")
  }
}

parallel jobs




On Monday, December 12, 2016 at 10:06:10 AM UTC-6, Daniel Beck wrote:
>
>
> > On 12.12.2016, at 16:47, Bryce Pepper > 
> wrote: 
> > 
> > "a b  c,d, e , f" parameters are passing now but I am not getting the 
> "parallel" execution desired. All of the spawned jobs have the same build 
> number and if I look at completed job it has the passed parameter "f". 
>
> I'm pretty sure you're not passing different parameters -- just print 
> `deployment` inside the actual block, not directly in the loop. 
>
> And if that's correct: Jenkins collapses identical queue items. Use 
> different parameters if you want different builds. 
>
>
>

-- 
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/86505b11-8b64-4531-9a3a-eca5ac87c989%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spawn multiple jobs

2016-12-12 Thread Bryce Pepper
"a b  c,d, e , f" parameters are passing now but I am not getting the 
"parallel" execution desired. All of the spawned jobs have the same build 
number and if I look at completed job it has the passed parameter "f". 

def inputParameter = 
build.buildVariableResolver.resolve("inputParameter").split(/[ ,]+/)
def branches = [:]
def int i = 0 
for (String deployment : inputParameter) {
  println("${i} ${deployment}")
  
  branches["deployment-${deployment}"] = {
build( 'aa', inputParameter: "${deployment}" )
  }
  
  i++   
}

parallel branches

OUTPUT:

Started by user
0 a
1 b
2 c
3 d
4 e
5 f
parallel {
Schedule job aa 
Schedule job aa 
Schedule job aa 
Schedule job aa 
Schedule job aa 
Schedule job aa 
Build aa #23  started
Build aa #23  started
Build aa #23  started
Build aa #23  started
Build aa #23  started
Build aa #23  started
aa #23  completed 
}
Aborted by
Build was aborted
Finished: ABORTED




-- 
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/e38e3d52-31cf-4fbd-be0d-aa73a875b4aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spawn multiple jobs

2016-12-09 Thread Bryce Pepper
I tried the Groovy plugin and also the Build Flow Plugin...

I can get multiple jobs started in parallel but I can't get the parameter 
to pass to the child jobs.

import hudson.model.*
def inputParameter = build.buildVariableResolver.resolve("inputParameter")
def branches = [:]
def int i = 0 
inputParameter.replaceAll("^[,\\s]+", "").split("[,\\s]+").each {
  branches["branch${i}"] = { 
build('aa', Param1: [[$class: 'StringParameterValue', name: 
'inputParameter', value: "${it}"]])
  }
  i++
}
parallel branches



On Friday, December 9, 2016 at 8:54:45 AM UTC-6, Bryce Pepper wrote:

> I would like to start a new jenkins job for each word passed in a 
> parameter.
>
> I could use a post
>
> for eachWord in ${inputParameter//,/ }; do
> {
>   curl -X POST --silent --show-error --user user:token \
> 
> $JENKINS_URL/job/testJob/buildWithParameters?inputParameter=${eachWord}
> }
> done
>
> but I was hoping for a way to passthru the credentials of the user running 
> the parent job.
>
>
>

-- 
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/6b1184e3-5136-4034-b2b4-011437354b5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spawn multiple jobs

2016-12-09 Thread Bryce Pepper
Thanks for the quick reply.  I am not familiar with the pipeline plugin but 
was wondering how that job gets parameters, is it in the advanced project 
options? The scripting does not look difficult and I would follow the 
jobs_in_parallel.groovy example.

On Friday, December 9, 2016 at 9:18:29 AM UTC-6, Daniel Beck wrote:
>
> Could probably be done with a Pipeline: Get the parameter, tokenize, then 
> call build(…) a bunch of times in a (C-style) loop. 
>
> > On 09.12.2016, at 15:54, Bryce Pepper > 
> wrote: 
> > 
> > I would like to start a new jenkins job for each word passed in a 
> parameter. 
> > 
> > I could use a post 
> > 
> > for eachWord in ${inputParameter//,/ }; do 
> > { 
> >   curl -X POST --silent --show-error --user user:token \ 
> > 
> $JENKINS_URL/job/testJob/buildWithParameters?inputParameter=${eachWord} 
> > } 
> > done 
> > 
> > but I was hoping for a way to passthru the credentials of the user 
> running the parent job. 
> > 
> > 
> > 
> > -- 
> > 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-use...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/fc26224b-2936-4135-ae10-9326e77c01cf%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
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/83d61fc3-3b96-47d7-b265-5847b67898b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Spawn multiple jobs

2016-12-09 Thread Bryce Pepper
I would like to start a new jenkins job for each word passed in a parameter.

I could use a post

for eachWord in ${inputParameter//,/ }; do
{
  curl -X POST --silent --show-error --user user:token \

$JENKINS_URL/job/testJob/buildWithParameters?inputParameter=${eachWord}
}
done

but I was hoping for a way to passthru the credentials of the user running 
the parent job.


-- 
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/fc26224b-2936-4135-ae10-9326e77c01cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.