- build.result = anotherBuild.result
- if (anotherBuild.result != Result.SUCCESS && anotherBuild.result != Result.UNSTABLE) {
- // We abort this build right here and now.
- fail = true
- println("Build Failed")
- }
- } else {
- println("\\tAlready built")
- }
- }
+println "Kernel total "+ counter
+println "Kernel to build "+ toBuild.size()
+
+
+def kernelEnabledNode = 0
+hudson.model.Hudson.instance.nodes.each { node ->
+ if (node.getLabelString().contains("kernel")){
+ kernelEnabledNode++
+ }
+}
+println "Nb of live kernel enabled build node "+ kernelEnabledNode
+
+def ongoingBuild = []
+
+while (toBuild.size() != 0) {
+ if(ongoingBuild.size() <= (kernelEnabledNodei.intdiv(2))) {
+ def job = toBuild.pop()
+ ongoingBuild.push(job.scheduleBuild2(0))
+ println "\\t trigering" + HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName)
+ } else {
+ ongoingBuild.removeAll{ it.isCancelled() || it.isDone() }
+ }