2016-07-14 159 views
0

我有一些构建。每个版本都有两个标签。标签显示模块名称和版本。所以标签loogs喜欢one-module1.2.3two-module4.5.6如何通过TeamCity REST API指定多个标签来获取构建?

我可以这样做:

/httpAuth/app/rest/builds/?locator=tags:one-module,branch:unspecified:any&fields=build(tags(tag)) 

我会得到这样的:

{ 
    "build": [ 
    { 
     "tags": { 
     "tag": [ 
      { 
      "name": "1.2.4" 
      }, 
      { 
      "name": "one-module" 
      } 
     ] 
     } 
    }, 
    { 
     "tags": { 
     "tag": [ 
      { 
      "name": "1.2.3" 
      }, 
      { 
      "name": "one-module" 
      } 
     ] 
     } 
    } 
    ] 
} 

现在我想用标签one-module1.2.4获取最新版本。我如何做到这一点?

我试试这个:

/httpAuth/app/rest/builds/?locator=tags:one-module,1.2.4,branch:unspecified:any&fields=build(tags(tag)) 

但我得到这个:

Error has occurred during request processing (Bad Request). 
Error: jetbrains.buildServer.server.rest.errors.LocatorProcessException: Bad locator syntax: Invalid dimension name :'1.2.4'. Should contain only alpha-numeric symbols or be known one. Details: locator: 'tags:one-module,1.2.4,branch:unspecified:any', at position 16 
Invalid request. Check locator is specified correctly. 

我的TeamCity版本9.1.6。 TeamCity的REST API BuildLocator documentation说:

标签: - “”(逗号) - 构建标签的分隔列表(仅适用于构建 包含所有指定标签返回)

所以,我尝试通过2个或更多标签来选择构建。这不行?

我做错了什么?如何通过2个或更多标签获得构建最新版本?

回答

0

我意外地找到了通过两个或更多标签获取构建的方式。

解决方法:使用构建定位是这样的:tags:(one-tag,two-tag,three-tag,etc-tag)

我不知道它是正确的解决方案。如果这是正确的JetBrains只是忘了更新TC REST API的文档。或者这只是TeamCity内部的一些东西。我在文档的评论中询问了关于here的信息。

相关问题