如何在groovy中生成远程mercurial分支的列表?我想在Jenkins中添加动态选择器参数。Mercurial服务器以hgweb的形式运行。
发布于 2014-01-16 08:21:08
对于hgweb服务的Mercurial的存储库,可以从REPO-URL/branches?style=raw获得其分支的列表。
请将https://www.mercurial-scm.org/repo/hg/branches?style=raw输出作为示例。
发布于 2016-06-10 06:44:07
您可以在下面的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命令https://stackoverflow.com/questions/21156159
复制相似问题