码迷,mamicode.com
首页 > 其他好文 > 详细

How to use groovy script on jenkins

时间:2015-06-11 16:23:20      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!