And it turns out that code was splodge, man, so tedious. :D
Anyhoo, for reference and if anyone else finds it useful, the correct, more
lightweight solution is
def triggerJob( jobToTrigger, cause, parameters ) {
def currentJobFutures = Jenkins.getInstance().getQueue().getItems(
jobToTrigger)*.getFuture()
newJobFuture = parameters!=null ? jobToTrigger.scheduleBuild2( 0, cause,
parameters ) : jobToTrigger.scheduleBuild2( 0, cause )
return currentJobFutures.contains(newJobFuture) ? null : newJobFuture
}
On Friday, May 20, 2016 at 1:33:23 PM UTC+1, Niksan wrote:
>
> Ok, thanks to Daniel with the initial pointers I was able to start hunting
> down the correct path at least. Short of not being able to lock the queue,
> it will suffice.
>
>
--
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/ac89199f-87fd-4650-838d-a4ec2256b131%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.