diff --git a/purge-build-queue-by-name.groovy b/purge-build-queue-by-name.groovy index a2f33fa..28d94c1 100644 --- a/purge-build-queue-by-name.groovy +++ b/purge-build-queue-by-name.groovy @@ -1,5 +1,11 @@ //Purge build queue by name +// find tasks by name which contains string pattern REPLACEME import hudson.model.* def q = Jenkins.instance.queue -q.items.findAll { it.task.name.startsWith('REPLACEME') }.each { q.cancel(it.task) } +q.items.findAll { it.task.name.contains('REPLACEME') }.each { println it.task.name } + +// purge +import hudson.model.* +def q = Jenkins.instance.queue +q.items.findAll { it.task.name.contains('REPLACEME') }.each { q.cancel(it.task) }