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

如何解决使用GET API列出基于Azure YAML的基于Azure管道的所有任务

要列出特定项目中的所有Azure构建管道,我们使用以下API。 '获取https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1'

不过,URL上方提供了以经典方法构建的那些管道的每个任务及其状态的详细信息。

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

解决方法

如果要获取每个任务的状态,可以使用Timeline endpoint

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","name": "Install ReportGenerator tool","startTime": "2020-10-15T02:40:51.62Z","finishTime": "2020-10-15T02:40:56.15Z","changeId": 16,"order": 6,"log": {
                "id": 9,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/9"
            },"id": "79cd0884-5219-46b7-8a84-6c86f173b37d","name": "Finalize Job","startTime": "2020-10-15T02:41:00Z","finishTime": "2020-10-15T02:41:00.0966667Z","percentComplete": 100,"changeId": 19,"order": 10,"log": {
                "id": 13,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/13"
            },"task": null,"id": "006e6f7c-8314-5e02-a3df-483f3a1f4cfa","name": "Build","startTime": "2020-10-15T02:40:36.9566667Z","finishTime": "2020-10-15T02:40:42.92Z","changeId": 12,"order": 4,"log": {
                "id": 7,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/7"
            },"id": "13d91b18-76dd-4a31-974e-315f76b11e38","name": "Post-job: Checkout kmadof/devops-manual@master to s","startTime": "2020-10-15T02:40:59.6166667Z","finishTime": "2020-10-15T02:40:59.9933333Z","order": 9,"log": {
                "id": 12,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/12"
            },"id": "2d6c4c72-58a7-539f-c145-2ca69ec02c01","name": "Publish code coverage","startTime": "2020-10-15T02:40:57.41Z","finishTime": "2020-10-15T02:40:59.6166667Z","order": 8,"log": {
                "id": 11,"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"
            },"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","changeId": 21,"queueId": 45,"order": 1,"log": {
                "id": 14,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/14"
            },"identifier": "Job.__default"
        },"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","changeId": 2,"workerName": null,"log": null,"identifier": "Checkpoint"
        },"id": "96ac2280-8cb4-5df5-99de-dd2da759617d","parentId": null,"type": "Stage","name": "__default","finishTime": "2020-10-15T02:41:02.19Z","changeId": 6,"identifier": "__default"
        },"id": "8ba42753-b8a8-4e99-acd4-e18b769ad4b9","name": "Initialize job","startTime": "2020-10-15T02:40:22.5133333Z","finishTime": "2020-10-15T02:40:25.9766667Z","changeId": 8,"log": {
                "id": 4,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/4"
            },"id": "6278c56e-b9dd-5471-9c3c-f3062039459c","name": "Test","startTime": "2020-10-15T02:40:42.92Z","finishTime": "2020-10-15T02:40:51.62Z","changeId": 14,"order": 5,"log": {
                "id": 8,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/8"
            },"id": "63e8042a-f367-5aec-692c-fcc654be55e4","name": "Checkout kmadof/devops-manual@master to s","startTime": "2020-10-15T02:40:25.9866667Z","finishTime": "2020-10-15T02:40:28.7266667Z","changeId": 10,"order": 2,"log": {
                "id": 5,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/5"
            },"id": "9c939e41-62c2-5605-5e05-fc3554afc9f5","name": "Create reports","startTime": "2020-10-15T02:40:56.15Z","finishTime": "2020-10-15T02:40:57.41Z","changeId": 17,"order": 7,"log": {
                "id": 10,"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"
            },"id": "3a3a2a60-14c7-570b-14a4-fa42ad92f52a","type": "Phase","finishTime": "2020-10-15T02:41:01.8633333Z","changeId": 20,"log": {
                "id": 3,"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/7512/logs/3"
            },"identifier": "Job"
        }
    ],"lastChangedBy": "00000002-0000-8888-8000-000000000000","lastChangedOn": "2020-10-15T02:41:02.327Z","id": "51dc2542-9fa2-49ac-b8c5-0c57412d7692","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"
        }
    },

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)> insert overwrite table dwd_trade_cart_add_inc > select data.id, > data.user_id, > data.course_id, > date_format(
错误1 hive (edu)> insert into huanhuan values(1,'haoge'); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive> show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 <configuration> <property> <name>yarn.nodemanager.res