且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Groovy for Jenkins取消排队的构建并中止正在执行的构建

更新时间:2023-12-05 14:00:10

我自己尚未对其进行测试,而是查看

I haven't tested it myself, but looking at the API it should be possible in the following way:

import hudson.model.*

def q = Jenkins.instance.queue

q.items.findAll { it.task.name.startsWith('my') }.each { q.cancel(it.task) }

相关API链接:

  • http://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html
  • http://javadoc.jenkins-ci.org/hudson/model/Queue.html