2
有没有什么方法可以检查一下Jenkins控制台Groovy脚本中是否存在Git分支?我现在有这个:检查詹金斯Groovy脚本中是否存在Git分支
import hudson.model.*
// For each project
for(item in Hudson.instance.items) {
// check that job is not building
if(!item.isBuilding()) {
if (item.scm instanceof hudson.plugins.git.GitSCM) {
println("Item name: " + item.name);
item.scm.repositories.each {
println("Repo " + it.name);
it.URIs.each {uri ->
println("URI: " + uri.toString());
}
}
item.scm.branches.each {
println("Branch " + it.name);
}
}
}
else {
println("Skipping job "+item.name+", currently building")
}
}
这打印詹金斯的作业名称,存储库和分支机构,但我可以运行测试拉为了验证分支存在?
此时我无法安装Git commit hook来记录已删除的分支名称,因此必须使用脚本求助于计划的分支存在验证。
谢谢!