在jenkins Extensible Choice插件中使用groovy script获取git仓库代码分支
·
样例



groovy script代码
import groovy.json.*
import java.text.SimpleDateFormat
import groovy.json.JsonSlurper;
try{
List<String>params = new ArrayList<String>()
URL apiUrl ="https://gitee.com/api/v5/repos/{组织名称}/{仓库名称}/branches?access_token={授权token}".toURL()
List json = new JsonSlurper().parse(apiUrl.newReader())
for (repo in json ) {
params.add(repo.name)
}
return params
}
catch(IOException ex){
print ex
}
更多推荐


所有评论(0)