Dynamic Choice Parameter: Choice Git branch when build Jenkins job
在构建Jenkins Job时,需要选择Git库的branch. 可以用如下方式实现:
在Git 库中用$BRANCH获取版本即可。
效果如下:
def gettags = ("git ls-remote -h https://ttt.xxx.com/scm/xx/xxxx.git").execute()
gettags.text.readLines().collect { it.split()[1].replaceAll('refs/heads/', '') }.unique()