2017-06-11 4 views
0

私はTFS & VSTSでビルドを監視しており、実行中のビルドまたはリリースの全体的な進捗状況(パーセンテージ)を取得する方法を知りたいと考えています。TFS REST APIを使用して実行中のビルドの進捗を取得する方法は?

+1

どのバージョンのTFS? XAMLビルドを使用していますか? – JamesQMurphy

+0

Fiddlerまたはブラウザコンソールを使用して、実行中のビルドのRest呼び出しをスニッフィングします – k7s5a

+0

次の要求は何を返しますか? "GET https:// {instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}?api-version = {version}" – Eduard

答えて

1

タイムライン付きのRest API Get build detailsを使用できます。ビルドタイムラインとはpercentComplete結果を含むいくつかのより多くの詳細情報を返します

GET https://{instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}/timeline?api-version={version} 

。注:これは、ビルド全体ではなく、webportalのビルドログと同様に、タスクレベルに基づいています。

サンプル応答

{ 
    "records": [ 
    { 
     "id": "bcddc27d-c891-4209-85d6-387e155439b0", 
     "parentId": "045f4ce9-cb71-424f-84de-4ab19281dc70", 
     "type": "Task", 
     "name": "Build solution **\\*.sln", 
     "startTime": "2015-07-16T19:53:20.853Z", 
     "finishTime": "2015-07-16T19:53:28.567Z", 
     "currentOperation": null, 
     "percentComplete": 100, 
     "state": "completed", 
     "result": "succeeded", 
     "resultCode": null, 
     "changeId": 16, 
     "lastModified": "0001-01-01T00:00:00", 
     "workerName": "Hosted Agent", 
     "order": 2, 
     "details": { 
     "id": "ef959107-e566-4c28-8d9f-354d605dd400", 
     "changeId": 6, 
     "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/builds/391/Timeline/ef959107-e566-4c28-8d9f-354d605dd400" 
     }, 
     "errorCount": 0, 
     "warningCount": 1, 
     "url": null, 
     "log": { 
     "id": 2, 
     "type": "Container", 
     "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/builds/391/logs/2" 
     }, 
     "issues": [ 
     { 
      "type": "warning", 
      "category": "General", 
      "message": "The MSBuild version parameter has been deprecated. Ignoring value: latest", 
      "data": { 
      "type": "warning" 
      } 
     } 
     ] 
    }, 
    { 
     "id": "b5bb4de7-a8ea-4c7d-8491-3f745bba7d1b", 
     "parentId": "045f4ce9-cb71-424f-84de-4ab19281dc70", 
     "type": "Task", 
     "name": "Get sources", 
     "startTime": "2015-07-16T19:53:07.057Z", 
     "finishTime": "2015-07-16T19:53:19.493Z", 
     "currentOperation": null, 
     "percentComplete": 100, 
     "state": "completed", 
     "result": "succeeded", 
     "resultCode": null, 
     "changeId": 13, 
     "lastModified": "0001-01-01T00:00:00", 
     "workerName": "Hosted Agent", 
     "order": 1, 
     "details": null, 
     "errorCount": 0, 
     "warningCount": 0, 
     "url": null, 
     "log": { 
     "id": 1, 
     "type": "Container", 
     "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/builds/391/logs/1" 
     } 
    }, 

enter image description here

+0

ビルド内の1つのタスクだけでなく、全体的な進捗状況の評価を取得または計算するソリューションを探しています。 –

+0

@ AlonAmsalem残念ながら、これは現在Rest APIを使用しては利用できません。このリンクにユーザボイスを追加することができます。https://visualstudio.uservoice.com/forums/330519-team-services、TFS PMはあなたの提案を親切に評価します。 –

関連する問題