How to use groovy script on Jenkins

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.