jenkins插件之Active Choices Parameter

来源:互联网 发布:产品主数据 编辑:程序博客网 时间:2024/06/07 03:06

勾选Groovy Script

在  Script----Groovy Script中输入:

def connection = new URL("http://10.103.27.177:8090/project/getBranchList?clusterName=jianlc-mgmt").openConnection();
connection.setRequestMethod('GET');connection.doOutput = true;
def writer = new OutputStreamWriter(connection.outputStream);writer.flush();writer.close();connection.connect();
def respText = connection.content.text;


def slurper = new groovy.json.JsonSlurper()
def branchs = slurper.parseText(respText)


return branchs;


实现:

通过自动获取git工程所有的分支,进行选择。