标签:
1. Install groovy plugin
2. Add a step of groovy. (normal & systerm)
3. Execute groovy script
import jenkins.model.* def q = Jenkins.instance.queue q.items.findAll{ it.task.name.startsWith(‘ttt‘) }.each{ q.cancel(it.task) }
Above script is cancel all pending 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 default version, test it with:
$ groovy -version
That‘s all thereis to it!
How to use groovy script on jenkins
标签:
原文地址:http://www.cnblogs.com/root-wang/p/4569095.html