1. Install Groovy Plugin
2. Add a step of groovy. (Normal & Systerm)
3. Execute Groovy Script
Import Jenkins.model.*def q = jenkins.instance.queueq.items.findall{it.task.name.startsWith (' TTT ')}.each{q.cancel ( It.task)}
Above script is cancel all pending the build in queue.
Additional Info:
Install Groovy:
GVM (The Groovyenvironment Manager)
This tool makesinstalling Groovy on any Bash platform (Mac OSX, Linux, Cygwin, Solaris Orfreebsd) very easy.
Simply Open a newterminal and enter:
$ curl-s Get.gvmtool.net | Bash
Follow theinstructions on-screen to complete installation.
Open a newterminal or type the command:
$ source "$HOME/.gvm/bin/gvm-init.sh"
Then install thelatest stable Groovy:
$ GVM Install Groovy
After Installationis complete and you ' ve made it your the default version, test it with:
$ groovy-version
That's all Thereis to it!
How to use groovy script on Jenkins