美文网首页
jenkins 获取分支

jenkins 获取分支

作者: _一叶孤帆 | 来源:发表于2021-04-27 18:02 被阅读0次

添加构建参数


image.png image.png
def gitURL = "填写 URL"
def command = "git ls-remote -h $gitURL"

def proc = command.execute()
proc.waitFor()         

if ( proc.exitValue() != 0 ) {
   println "Error, ${proc.err.text}"
   System.exit(-1)
}     

def branches = proc.in.text.readLines().collect {
    it.replaceAll(/[a-z0-9]*\trefs\/heads\//, '') 
}   
return branches.join(",")

相关文章

网友评论

      本文标题:jenkins 获取分支

      本文链接:https://www.haomeiwen.com/subject/xwdprltx.html