如何从 Azure DevOps 中的 YAML 管道获取阶段结果 [英] How to get stage results from YAML pipelines in Azure DevOps
问题描述
到目前为止,我使用的是
更新第二种方式:
您可以在浏览器中按F12
,然后选择Network
捕获请求以获取阶段结果.您可以从响应正文中捕获结果.但是不同阶段的结果用不同的数字表示,即0->完成,5->取消等
Until now, I am using the Azure DevOps REST Api to get the data from releases in Azure DevOps for reporting purpose. Obviously, this will change with the new way how to use CI/CD --> YAML and the Multi-Stage-Pipeline (currently preview). In that case the build- and release-strategy is deprecated and everything is defined as a pipeline and subdivided into staged (build stage, deploy stage 1, deploy stage 2, ...).
I tried to receive data via the build list method, but this data is limited and I am missing some important information like 'was stage successful'.
Does anybody have already experience with the compination of YAML Pipelines and the Azure DevOps REST Api? Is there a way to get the full data (as with classic release strategy)? Or is it currently under development and I have to be patient?
Thanks in advance!
How to get stage results from YAML pipelines in Azure DevOps
For this issue, you need to use Status - Get rest api.
GET https://dev.azure.com/{organization}/{project}/_apis/build/status/{definition}?api-version=5.1-preview.1
This api can get the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.
Here is my test with postman:
Update Second way:
You can press F12
in the browser then select Network
to capture the request to get the stage result.You can capture the result from the response body. But different stage results are represented by different numbers i.e 0->completed,5->canceled etc.
这篇关于如何从 Azure DevOps 中的 YAML 管道获取阶段结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!