How to get changes out of build (api)
Hello,
How can I get (api) the new changes (list of change-sets) of a build ?
I want to change the status of all the work-items that was included in a build.
I created a participant action at the start of a build but can't get the change-sets.
Thanks,
Yehiel
|
2 answers
Nick Edgar (6.5k●7●11)
| answered May 14 '13, 12:39 p.m.
JAZZ DEVELOPER edited May 14 '13, 12:40 p.m.
Hi Yehiel, your participant would need to run after the SCM participant. The change sets that were accepted are not directly referenced by the build (though we do link to work items associated with those change sets). Instead, we add a contribution to the build pointing to the SCM snapshot taken after the accept. When you click the Changes link on a build, it's actually comparing with the snapshot from the previous (non-personal) build, and delegating to the Change Explorer / Change Summary view to show the changes.
If it's really the work items you're after, take a look at the code in:
com.ibm.team.build.internal.client.workitem.WorkItemHelper.getIncludedWorkItems(ITeamRepository, IBuildResultHandle, IProgressMonitor)
which does a links query:
Comments Not sure why the forum software is making iworkitemhandle be lower case. It should be IWorkItemHandle, which is what I pasted. The buildLinkType is:
com.ibm.team.build.internal.common.links.BuildLinkTypes.INCLUDED_WORK_ITEMS
whose value is "com.ibm.team.build.linktype.includedWorkItems"
There's actually a dual representation for "included in build" work item links. In addition to the links, we also keep them as a build result contribution, with a content blob listing the work item item ids (UUIDs). See the code in:
com.ibm.team.build.internal.client.workitem.WorkItemHelper.getFixedInBuild(ITeamRepository, IBuildResultHandle, IProgressMonitor)
if you want to go that route.
Hi, Nick I am trying to fetch the work items included in build result in event handling follow up action, it is the server side behavior. So I can not use the code you mentioned with client API. Do you have any suggestion for server side API for ILink service to get the included work items for a build result? |
From the other forum topic, I get the answer:
ILinkService linkService = getService(ILinkService.class); ILinkServiceLibrary linkLibrary = (ILinkServiceLibrary) linkService.getServiceLibrary(ILinkServiceLibrary.class); IReference source = linkLibrary.referenceFactory().createReferenceToItem(buildResultHandle); ILinkCollection referencesToResults = linkLibrary.findLinksBySource(buildLinkType, source).getAllLinksFromHereOn(); |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.