zoukankan      html  css  js  c++  java
  • How to use groovy script on jenkins

    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!

  • 相关阅读:
    Zepto源码分析-动画(fx fx_method)模块
    CSS3用法理解
    移动端网页meta设置和响应式
    javascript基础-正则表达式
    net core 2.x
    angular
    .net core 2.x
    .net core 2.x
    DDD
    DDD
  • 原文地址:https://www.cnblogs.com/root-wang/p/4569095.html
Copyright © 2011-2022 走看看