列出使用GET API的基于azure YAML的管道的所有任务



要列出我们在API下面使用的特定项目中的所有azure构建管道。'获取https://dev.azure.com/{组织}/{项目}/_apis/管道?api版本=6.0-preview.1'

然而,上面的URL给出了在经典方法中构建的管道的每个任务及其状态的详细信息。

它没有给出在基于YAML的管道中定义的每个任务的详细信息。如何使用基于YAML的管道获取具有任务名称及其状态的所有任务的详细信息

如果您想获得每个任务的状态,可以使用Timeline端点

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline/{timelineId}?api-version=6.0

然后你会得到这样的回应:

{
"records": [
{
"previousAttempts": [],
"id": "2b20c7d0-7587-5b0f-aadc-b456e6f0b807",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Restore nuget packages",
"startTime": "2020-10-15T02:40:28.7266667Z",
"finishTime": "2020-10-15T02:40:36.9566667Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 11,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 3,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 6,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/6"
},
"task": {
"id": "5541a522-603c-47ad-91fc-a4b1d163081b",
"name": "DotNetCoreCLI",
"version": "2.175.0"
},
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "bfbec40a-1b5e-5690-b870-859627cad0c0",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Install ReportGenerator tool",
"startTime": "2020-10-15T02:40:51.62Z",
"finishTime": "2020-10-15T02:40:56.15Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 16,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 6,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 9,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/9"
},
"task": {
"id": "5541a522-603c-47ad-91fc-a4b1d163081b",
"name": "DotNetCoreCLI",
"version": "2.175.0"
},
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "79cd0884-5219-46b7-8a84-6c86f173b37d",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Finalize Job",
"startTime": "2020-10-15T02:41:00Z",
"finishTime": "2020-10-15T02:41:00.0966667Z",
"currentOperation": null,
"percentComplete": 100,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 19,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 10,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 13,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/13"
},
"task": null,
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "006e6f7c-8314-5e02-a3df-483f3a1f4cfa",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Build",
"startTime": "2020-10-15T02:40:36.9566667Z",
"finishTime": "2020-10-15T02:40:42.92Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 12,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 4,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 7,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/7"
},
"task": {
"id": "5541a522-603c-47ad-91fc-a4b1d163081b",
"name": "DotNetCoreCLI",
"version": "2.175.0"
},
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "13d91b18-76dd-4a31-974e-315f76b11e38",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Post-job: Checkout kmadof/devops-manual@master to s",
"startTime": "2020-10-15T02:40:59.6166667Z",
"finishTime": "2020-10-15T02:40:59.9933333Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 19,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 9,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 12,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/12"
},
"task": null,
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "2d6c4c72-58a7-539f-c145-2ca69ec02c01",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Publish code coverage",
"startTime": "2020-10-15T02:40:57.41Z",
"finishTime": "2020-10-15T02:40:59.6166667Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 19,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 8,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 11,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/11"
},
"task": {
"id": "2a7ebc54-c13e-490e-81a5-d7561ab7cd97",
"name": "PublishCodeCoverageResults",
"version": "1.175.0"
},
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"parentId": "3a3a2a60-14c7-570b-14a4-fa42ad92f52a",
"type": "Job",
"name": "Job",
"startTime": "2020-10-15T02:40:22.1466667Z",
"finishTime": "2020-10-15T02:41:00.1Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 21,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"queueId": 45,
"order": 1,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 14,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/14"
},
"task": null,
"attempt": 1,
"identifier": "Job.__default"
},
{
"previousAttempts": [],
"id": "22a533e7-39a9-5e07-6138-b595446c3168",
"parentId": "96ac2280-8cb4-5df5-99de-dd2da759617d",
"type": "Checkpoint",
"name": "Checkpoint",
"startTime": "2020-10-15T02:40:13.35Z",
"finishTime": "2020-10-15T02:40:13.35Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 2,
"lastModified": "0001-01-01T00:00:00",
"workerName": null,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": null,
"task": null,
"attempt": 1,
"identifier": "Checkpoint"
},
{
"previousAttempts": [],
"id": "96ac2280-8cb4-5df5-99de-dd2da759617d",
"parentId": null,
"type": "Stage",
"name": "__default",
"startTime": "2020-10-15T02:40:22.1466667Z",
"finishTime": "2020-10-15T02:41:02.19Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 6,
"lastModified": "0001-01-01T00:00:00",
"workerName": null,
"order": 1,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": null,
"task": null,
"attempt": 1,
"identifier": "__default"
},
{
"previousAttempts": [],
"id": "8ba42753-b8a8-4e99-acd4-e18b769ad4b9",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Initialize job",
"startTime": "2020-10-15T02:40:22.5133333Z",
"finishTime": "2020-10-15T02:40:25.9766667Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 8,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 1,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 4,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/4"
},
"task": null,
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "6278c56e-b9dd-5471-9c3c-f3062039459c",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Test",
"startTime": "2020-10-15T02:40:42.92Z",
"finishTime": "2020-10-15T02:40:51.62Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 14,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 5,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 8,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/8"
},
"task": {
"id": "5541a522-603c-47ad-91fc-a4b1d163081b",
"name": "DotNetCoreCLI",
"version": "2.175.0"
},
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "63e8042a-f367-5aec-692c-fcc654be55e4",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Checkout kmadof/devops-manual@master to s",
"startTime": "2020-10-15T02:40:25.9866667Z",
"finishTime": "2020-10-15T02:40:28.7266667Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 10,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 2,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 5,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/5"
},
"task": null,
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "9c939e41-62c2-5605-5e05-fc3554afc9f5",
"parentId": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"type": "Task",
"name": "Create reports",
"startTime": "2020-10-15T02:40:56.15Z",
"finishTime": "2020-10-15T02:40:57.41Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 17,
"lastModified": "0001-01-01T00:00:00",
"workerName": "Azure Pipelines 2",
"order": 7,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 10,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/10"
},
"task": {
"id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9",
"name": "CmdLine",
"version": "2.176.1"
},
"attempt": 1,
"identifier": null
},
{
"previousAttempts": [],
"id": "3a3a2a60-14c7-570b-14a4-fa42ad92f52a",
"parentId": "96ac2280-8cb4-5df5-99de-dd2da759617d",
"type": "Phase",
"name": "Job",
"startTime": "2020-10-15T02:40:22.1466667Z",
"finishTime": "2020-10-15T02:41:01.8633333Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 20,
"lastModified": "0001-01-01T00:00:00",
"workerName": null,
"order": 1,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 3,
"type": "Container",
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/3"
},
"task": null,
"attempt": 1,
"identifier": "Job"
}
],
"lastChangedBy": "00000002-0000-8888-8000-000000000000",
"lastChangedOn": "2020-10-15T02:41:02.327Z",
"id": "51dc2542-9fa2-49ac-b8c5-0c57412d7692",
"changeId": 21,
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/Timeline/51dc2542-9fa2-49ac-b8c5-0c57412d7692"
}

通过这种方式,您将获得给定管道的给定运行的状态,但我认为没有端点可以在一次拍摄中为您提供每个管道的任务状态。

此外,如果您调用构建状态端点:

https://dev.azure.com/{{organization}}/{{project}}/_apis/build/builds/7512?api-version=6.0&expand=all

在响应的顶部,您将获得时间轴的链接

{
"_links": {
"self": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/Builds/7512"
},
"web": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_build/results?buildId=7512"
},
"sourceVersionDisplayUri": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/sources"
},
"timeline": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/Timeline"
},
"badge": {
"href": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/status/8"
}
},

相关内容

  • 没有找到相关文章

最新更新