2016-07-14 162 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的信息。

相關問題