Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
214 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

enter image description here

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

enter image description here

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.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...