jenkins 参数化构建,获取git分支

def heads= ("git ls-remote -h git@gitlab.com:*.git").execute()
def headlist=heads.text.readLines().collect{it.split()[1]};
def list=[''];
list.addAll(headlist);
return list;

原文地址:https://www.cnblogs.com/paisen/p/8341752.html