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.
The future has a variable in there called 'task' I didn't see this in the docs at all and saw it doing a .dump() of the object, with this in hand I was able to do the following. def queue = Jenkins.getInstance().getQueue() def ids = queue.getItems()*.getId() def job = jobToTrigger.scheduleBuild2( 1, new Cause.UpstreamCause( build ) ) if(!ids.contains(queue.getItem(job.task).getId())) { println("Adding job ${job.task}") futureJobs.add( job ) } else { println("Job aleady queued") } It's doesn't look great for me, and I'll be suprised if there's not a better approach, but something is better than nothing I guess. On Friday, May 20, 2016 at 12:41:44 PM UTC+1, Niksan wrote: > > Also, how is one supposed to getId() from a hudson.model.queue.FutureImpl > exactly? > > On Thursday, May 19, 2016 at 8:09:22 PM UTC+1, Daniel Beck wrote: >> >> >> > On 19.05.2016, at 15:37, 'Niksan' via Jenkins Users < >> jenkins...@googlegroups.com> wrote: >> > >> > So, you can fire jobs off in Groovy using ScheduleBuild2 which returns >> a future. By its nature, Jenkins will purge any duplicate build requests >> at some point. >> >> -- 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/023bc95d-e382-4264-a6ed-174110072ee5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.