为什么azure-api不显示与构建相关的工作项? [英] Why azure-api does not show build related work items?

查看:51
本文介绍了为什么azure-api不显示与构建相关的工作项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们创建并运行一个构建,该构建具有关联的更改和链接的工作项.但是,如果尝试从api获取链接项,则响应元素为0.对于某些构建,此方法有效,但对于其他构建,则无效.

运行构建时,构建与工作项之间建立了哪些连接?我们如何获取链接的工作项列表,这些工作项在构建摘要中可以看到?p.s.请求URL是100%正确的,因为有时我们会有正确的响应,但是当我们更改 build_id 时,就会遇到问题.

我们试图根据版本ID和版本号找出确切的行为,但没有成功.

示例:创建工作项,将其修复在分支中,将分支合并到master中,发布构建.

工作项已附加到内部版本,通过API请求时显示.我们将删除已发布的内部版本,然后再次释放该内部版本,然后该工作项将丢失并且不会与任何其他内部版本绑定(因为第一个内部版本已删除).

在不删除构建的情况下也会发生类似的情况,但我们只是无法获得工作项.

解决方案

运行构建时,构建与工作项之间建立了哪些连接?如何获得链接的工作项列表,这些工作项在构建摘要中可以看到?

我们可以在下面的

推送提交并添加相关的工作项,然后我们可以在构建摘要页面中看到这些工作项.

工作项已附加到内部版本,通过API请求时显示.我们删除已发布的版本,然后再次发布

步骤是创建分支->推送提交并添加工作项->创建拉取请求并触发构建,应通过CI或拉取请求触发器触发构建,然后检查构建链接的工作项->删除此版本并手动重新触发此版本,然后再次检查链接的工作项,结果是在新版本中看不到链接的工作项,对吧?

这是设计使然,如果我们手动触发构建,则可以在工作项的链接"选项卡中添加此链接,而在摘要页面中看不到该工作项,但是我们可以通过之前共享的API列出该工作项.请检查下面的图片.

We create and run a build, which has associated changes and linked work items. But if we try to get linked items from the api, we have 0 response elements. For some builds, this works, but for others it does not.

What connections are made between the build and the workitem when we run the build? How we can get list of linked work items, which we see in summary of build? p.s. The request URL is 100% correct, because sometimes we have a correct response, but then we have a problem when we change build_id.

We tried to figure out the exact behavior based on the build id and build number, but we didn't succeed.

Example: create a workitem, fix it in a branch, merge a branch into master, release a build.

A workitem is attached to the build, shown when requested via the API. We delete the released build, release the build again, then the workitem is lost and it is not tied to any other build (since the first one was deleted).

Something similar happens without deleting the build, but we just can't get a workitem.

解决方案

What connections are made between the build and the workitem when we run the build? How we can get list of linked work items, which we see in summary of build?

We could use below REST API to list build linked work items.

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

And steps:

We need open the build definition->Click Triggers tab and enable the feature Enable continuous integration, then click Option tab and enable the feature Automatically link new work in this build

Push commit and add related work items, then we could see these work items in the build summary page.

A workitem is attached to the build, shown when requested via the API. We delete the released build, release the build again

The steps is create branch->push commit and add work item->create pull request and trigger build, the build should be triggered via CI or pull request trigger, then check the build linked work item->delete this build and re-triggered this build manually then check the linked work item again, the result is cannot see the linked work item in the new build, right?

This is by designed, If we trigger build manually, we could add this link in the work item Link tab and we could not see the work item in the summary page, but we could list the work item via the API shared before. Please check the pic below.

这篇关于为什么azure-api不显示与构建相关的工作项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆