Groovy post script, how to get downstream job finished

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Groovy post script, how to get downstream job finished

pawanpreeteng
Hi Everyone,

I am triggering 2 downstream jobs in groovy post build as


nextJob1.scheduleBuild(5, new
hudson.model.Cause.UpstreamCause(manager.build), new
hudson.model.ParametersAction(values));


nextJob2.scheduleBuild(5, new
hudson.model.Cause.UpstreamCause(manager.build), new
hudson.model.ParametersAction(values));


But i need second to start when first is completed. I know there must
be a way to get status from first and only then start second.


I am not using parameterized plugin/join plugin because i have choice
parameter to select no of jobs i need to run.

Any idea will be greatly appreciated.

Thanks
Pawan
Reply | Threaded
Open this post in threaded view
|

Re: Groovy post script, how to get downstream job finished

kohsuke Kawaguchi (CB)

Yes, use "scheduleBuild2", which returns a Future object that represents
the build that's scheduled.

So if you do Future.get(), the method will block until the build is
completed, and you get the Build object back.

On 02/03/2011 09:51 AM, Pawan wrote:

> Hi Everyone,
>
> I am triggering 2 downstream jobs in groovy post build as
>
>
> nextJob1.scheduleBuild(5, new
> hudson.model.Cause.UpstreamCause(manager.build), new
> hudson.model.ParametersAction(values));
>
>
> nextJob2.scheduleBuild(5, new
> hudson.model.Cause.UpstreamCause(manager.build), new
> hudson.model.ParametersAction(values));
>
>
> But i need second to start when first is completed. I know there must
> be a way to get status from first and only then start second.
>
>
> I am not using parameterized plugin/join plugin because i have choice
> parameter to select no of jobs i need to run.
>
> Any idea will be greatly appreciated.
>
> Thanks
> Pawan
>


--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/