jenkins插件之Active Choices Parameter

勾选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工程所有的分支,进行选择。

相关文章
相关标签/搜索