且构网

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

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

更新时间:2023-12-05 13:51:22

我自己没有测试过,但是查看了 API 应该可以通过以下方式实现:

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

import hudson.model.*
import jenkins.model.Jenkins

def q = Jenkins.instance.queue

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

相关 API 链接: