如何在groovy中生成远程mercurial分支列表?我想在Jenkins中添加动态选择器参数。 Mercurial-server以hgweb运行。
答案 0 :(得分:1)
对于hgweb提供的Mercurial的存储库列表,它的分支可以从REPO-URL/branches?style=raw
获得
请将https://www.mercurial-scm.org/repo/hg/branches?style=raw输出视为样本。
答案 1 :(得分:0)
您可以将Extended choice parameter plugin与以下Groovy脚本一起使用:
def hgUser = "user"
def hgPassword = "password"
def hgUrl = "repo_url"
def args = [
"wget",
"-q",
"-O",
"-",
"https://" + hgUser + ":" + hgPassword + "@" + hgUrl + "/branches?style=raw"
];
def builder = new ProcessBuilder(args)
builder.redirectErrorStream(true)
def process = builder.start()
def branches = process.text.split("\n")*.split().findAll{
it[2] != "closed" // Retain only non-closed branches
}*.head()
return branches.join(',')
请注意
wget
命令