Abort modules build if a new build is queued
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 19 May 2016 15:58:26 +0000 (11:58 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 19 May 2016 15:58:26 +0000 (11:58 -0400)
scripts/lttng-modules/master-rt.groovy
scripts/lttng-modules/master-ubuntu.groovy
scripts/lttng-modules/master-vanilla.groovy

index 3b84c1ae7dd7aa9814e6ddd697a3e80a1f278f36..9d11387e2a43978dd282a71deea01fa6b4a22a8f 100644 (file)
@@ -120,6 +120,7 @@ def maxConcurrentBuild = build.buildVariableResolver.resolve('maxConcurrentBuild
 def kgitrepo = build.buildVariableResolver.resolve('kgitrepo')
 def kverfloor = new kVersion(build.buildVariableResolver.resolve('kverfloor'))
 def job = Hudson.instance.getJob(build.buildVariableResolver.resolve('kbuildjob'))
+def currentJobName = build.project.getFullDisplayName()
 
 // Get the out variable
 def config = new HashMap()
@@ -197,6 +198,15 @@ while ( kversions.size() != 0 || ongoingBuild.size() != 0 ) {
       }
     }
 
+    // Check for queued similar job since we only want to run latest
+    // as Mathieu Desnoyers requirement
+    similarJobQueued = Hudson.instance.queue.items.count{it.task.getFullDisplayName() == currentJobName}
+    if ( similarJobQueued > 0 ) {
+        // Abort since new build is queued
+        build.setResult(hudson.model.Result.ABORTED)
+        throw new InterruptedException()
+    }
+
     def i = ongoingBuild.iterator()
     while ( i.hasNext() ) {
       currentBuild = i.next()
index 1909d48e8d615b0a4b7ed214c74787f037896256..9f1869fab3dd98f35b34acf74e2511c24f3b6851 100644 (file)
@@ -29,6 +29,7 @@ def maxConcurrentBuild = build.buildVariableResolver.resolve('maxConcurrentBuild
 def kgitrepo = build.buildVariableResolver.resolve('kgitrepo')
 def uversion = build.buildVariableResolver.resolve('uversion')
 def job = Hudson.instance.getJob(build.buildVariableResolver.resolve('kbuildjob'))
+def currentJobName = build.project.getFullDisplayName()
 
 // Get the out variable
 def config = new HashMap()
@@ -128,6 +129,15 @@ while ( kversions.size() != 0 || ongoingBuild.size() != 0 ) {
       }
     }
 
+    // Check for queued similar job since we only want to run latest
+    // as Mathieu Desnoyers requirement
+    similarJobQueued = Hudson.instance.queue.items.count{it.task.getFullDisplayName() == currentJobName}
+    if ( similarJobQueued > 0 ) {
+        // Abort since new build is queued
+        build.setResult(hudson.model.Result.ABORTED)
+        throw new InterruptedException()
+    }
+
     def i = ongoingBuild.iterator()
     while ( i.hasNext() ) {
       currentBuild = i.next()
index 33c62f5424fad3888f4933b4fb05d4dae3f1d6a1..ea3222b936b2182b921125ec129bf48f634a987a 100644 (file)
@@ -218,7 +218,7 @@ while ( kversions.size() != 0 || ongoingBuild.size() != 0 ) {
     }
 
     // Check for queued similar job since we only want to run latest
-    // As Mathieu Desnoyers requirement
+    // as Mathieu Desnoyers requirement
     similarJobQueued = Hudson.instance.queue.items.count{it.task.getFullDisplayName() == currentJobName}
     if ( similarJobQueued > 0 ) {
         // Abort since new build is queued
This page took 0.025345 seconds and 4 git commands to generate.