I can view build results using the RTC eclipse client, but not with browser com.ibm.team.build.viewResult
K M (383●2●52●51)
| asked Nov 19 '13, 2:37 p.m.
retagged Dec 16 '13, 1:13 p.m. by David Lafreniere (4.8k●7)
I create build results using the java api, I can view the results using the eclipse client but not with the browser
https://rtc_instance:9443/jazz/web/projects/project1#action=com.ibm.team.build.viewResult&id=_OqxDUFBfEeOzj-1HuY57ug I get he result title but nothing else, no error is reported in the browser. When I hover on the build result in the browser, the result's information appears. |
2 answers
Hi K. The "included in build" links have a dual representation:
(1) a contribution to the build, as you're creating in the code above
(2) item links (ILink) between the build result and work item, of type "com.ibm.team.build.linktype.includedWorkItems"
See code in com.ibm.team.build.internal.publishing.WorkItemPublisher.tagWorkItems(IWorkItemHandle[], IBuildResult, ITeamRepository) for how (2) is done.
In the Eclipse UI, the build result gets the work items referenced from the build using (1) but in the web UI it uses (2). The links are also needed to see the referencing build(s) from work items, which don't know about build result contributions.
Comments
K M
commented Nov 26 '13, 6:39 p.m.
I did see that in one of the examples, but com.ibm.team.build.internal.publishing does not exists in
K M
commented Nov 26 '13, 6:45 p.m.
I also can not find them in the java api doc
Sorry, that code is in the com.ibm.team.build.toolkit plugin, which is in the 4.x SDK but was omitted from the 3.x SDK. See next answer for the relevant code. |
Here's the code I mentioned above.
private void tagWorkItems(IWorkItemHandle[] workItemHandles, IBuildResult buildResult, ITeamRepository teamRepository) throws TeamRepositoryException {
ILinkManager linkManager = (ILinkManager) teamRepository.getClientLibrary(ILinkManager.class); List unlinkedWorkItems = findUnlinkedWorkItems(workItemHandles, buildResult, linkManager); List links = new ArrayList();
List workItems = teamRepository.itemManager().fetchCompleteItems(unlinkedWorkItems, IItemManager.REFRESH, null); for (int i = 0; i < unlinkedWorkItems.size(); ++i) { IWorkItemHandle workItemHandle = (IWorkItemHandle) unlinkedWorkItems.get(i); IWorkItem workItem = (IWorkItem) workItems.get(i); links.add(createLink(teamRepository, workItemHandle, workItem, buildResult)); }
linkManager.saveLinks(links, null); } throws TeamRepositoryException { IBuildDefinition definition = (IBuildDefinition) teamRepository.itemManager().fetchCompleteItem( result.getBuildDefinition(), IItemManager.DEFAULT, null);
IHelperType helperType = IHelperType.IRegistry.INSTANCE.getHelperType( LinksPackage.eINSTANCE.getReference().getName(), LinksPackage.eNS_URI);
String sourceComment = ItemHelper.validateStringAttributeLength(definition.getId() + " " + result.getLabel(), //$NON-NLS-1$ helperType, LinksPackage.eINSTANCE.getReference_Comment().getName());
IReference source = IReferenceFactory.INSTANCE.createReferenceToItem(result, sourceComment);
IReference target; if (workItem == null) { // work item is missing or invisible, so create a link but provide no comment target = IReferenceFactory.INSTANCE.createReferenceToItem(workItemHandle); } else { String targetComment = ItemHelper.validateStringAttributeLength( WorkItemTextUtilities.getWorkItemText(workItem), helperType, LinksPackage.eINSTANCE.getReference_Comment().getName()); target = IReferenceFactory.INSTANCE.createReferenceToItem(workItemHandle, targetComment); }
return ILinkFactory.INSTANCE.createLink(BuildLinkTypes.INCLUDED_WORK_ITEMS, source, target); } Comments
where BuildLinkTypes.INCLUDED_WORK_ITEMS is:
public static final String INCLUDED_WORK_ITEMS = "com.ibm.team.build.linktype.includedWorkItems"; //$NON-NLS-1$
A lot of the logic here has to do with shortening the comment on the work item reference if needed. If too long for the field, the save will fail.
K M
commented Nov 27 '13, 1:27 p.m.
It works
Good to hear. Regarding the links, no there's no way to delete them. The intent is that you may still want to know which builds a work item's change sets were included in, even if the referenced build has been deleted. |
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.
Comments
when I use the eclipse gui, it reports the build result has no start request. Can this be the problem?
Is their any way of debuging this problem?
If I add a IBuildRequest buildRequest, I can now see most of the the build results
All except workitems associated with the results.
I add the work items to the result using
contribution = BuildItemFactory.createBuildResultContribution();
contribution.setExtendedContributionTypeId(WorkItemConstants.EXTENDED_DATA_TYPE_ID);
contribution.setImpactsPrimaryResult(false);
if ((handleIds != null) && (handleIds.length != 0)) {
contribution.setExtendedContributionData(ContentUtil.stringArrayToContent(repo, handleIds,'\n'));
}
result = buildClient.addBuildResultContribution(result, contribution,IBuildResult.PROPERTIES_COMPLETE, null);
I do not link the work item to the build result