Last active
July 16, 2021 10:53
-
-
Save cvakiitho/3c1cf58eb6a5becf30ad81a6efc12d21 to your computer and use it in GitHub Desktop.
remove branch indexing from build queue jenkins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.* | |
import jenkins.model.Jenkins | |
def timer = 5000 //5s timer | |
def counter = 12 * 10 // 10 minutes reruns | |
for (i = 0; i <counter; i++) { | |
def q = Jenkins.instance.queue | |
println("$i / ${counter}") | |
q.items.findAll { def causes = it.getCauses() | |
try { | |
return causes[0].getShortDescription() == 'Branch indexing' | |
} catch (e){} | |
}.each { | |
q.cancel(it.task) | |
} | |
sleep(timer) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script checks each 5s for 10 minutes,
if there are builds from branch indexing in the queue and cancels them