【发布时间】:2013-03-06 17:43:42
【问题描述】:
我正在使用 TeamCity 7.1。我想获取一个列表,其中包括当前未运行的每个构建配置(构建类型)的最后构建。我发现了这个问题:TeamCity - How do you get a list of the last finished build of each project through rest api? 但答案中的 REST URI 对我不起作用。
<teamcity-server>/httpAuth/app/rest/builds?locator=sinceBuild:(status:failure)
似乎有效,并为我提供了之前失败后成功的所有构建。
相反
<teamcity-server>/httpAuth/app/rest/builds?locator=sinceBuild:(status:success)
不返回任何构建。
我知道我可以获取所有构建类型,遍历它们并获取最新完成的构建使用
<teamcity-server>/httpAuth/app/rest/buildTypes/id:<build-type-id>/builds/running:false?count=1&start=0
("count=1&start=0" 可能不是必须的) 但我不确定我得到的是否真的是最新版本。这也需要对所有构建类型进行多次 REST 调用。一个简洁的解决方案将只使用一个 REST 调用。
有什么想法吗?
【问题讨论】:
-
我试过了,
<teamcity-server>/httpAuth/app/rest/builds?locator=sinceBuild:(status:failure)和<teamcity-server>/httpAuth/app/rest/builds?locator=sinceBuild:(status:success)都在工作。第二个可能不适合您,因为在最后一次成功构建之后您可能没有任何构建。然后它将返回 0 个计数。总的来说,它们中的任何一个都会给你一个 0 计数,因为你的最后一次构建要么是成功,要么是失败。