It's all about the answers!

Ask a question

Updating Work Items included in a build


barnaby relph (1834) | asked Jun 20 '11, 12:58 p.m.
Hi All,
this is my first post to Jazz.net, so please excuse me if this is the wrong forum or it's been solved before.

I'm just beginning work on automating our manual build process and the core of our process looks like this:

label codebase
accept latest changes to a build workspace
compile and deploy code to an Integration environment
update work items which contributed to the build to a new Status (to let developers and testers know to perform sanity and functional testing)

Using JBE and ANT, I can run builds and the snapshots that generates are fine for recording purposes, but I'm at a loss as to how to touch the work items. I imagine I'll have to be coding a custom ant task or similar in order to achieve this, but I thought I'd ask in case anyone has done something similar, or could point me in the right direction.

If it helps, we're currently on RTC 2, but are planning to upgrade to 3 in the near future.

Thanks very much

Barny

3 answers



permanent link
Brent Ulbricht (2.5k11) | answered Jun 20 '11, 3:07 p.m.
JAZZ DEVELOPER
Hi All,
this is my first post to Jazz.net, so please excuse me if this is the wrong forum or it's been solved before.

I'm just beginning work on automating our manual build process and the core of our process looks like this:

label codebase
accept latest changes to a build workspace
compile and deploy code to an Integration environment
update work items which contributed to the build to a new Status (to let developers and testers know to perform sanity and functional testing)

Using JBE and ANT, I can run builds and the snapshots that generates are fine for recording purposes, but I'm at a loss as to how to touch the work items. I imagine I'll have to be coding a custom ant task or similar in order to achieve this, but I thought I'd ask in case anyone has done something similar, or could point me in the right direction.

If it helps, we're currently on RTC 2, but are planning to upgrade to 3 in the near future.

Thanks very much

Barny


Hi,

I'm more familiar with the Build component Ant tasks, and we don't have one in the Build component that will modify the work items. Maybe someone else reading this knows of one in another component. If you do go the route of creating your own Ant task, this topic has some information about using the API to update a work item.

Brent Ulbricht
RTC Build Lead

permanent link
barnaby relph (1834) | answered Jun 22 '11, 5:00 a.m.
Brent, thanks very much for the reply. I've got a number of source code examples of doing similar things and I'm now digging into how all the objects hang together.

I think any further questions probably belong in the Extending RTC forum

thanks again

Barny

permanent link
Ralph Schoon (63.4k33646) | answered Jun 22 '11, 5:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Brent, thanks very much for the reply. I've got a number of source code examples of doing similar things and I'm now digging into how all the objects hang together.

I think any further questions probably belong in the Extending RTC forum

thanks again

Barny


Hi Barny,

code to create a link to a build result would be:


IBuildResult result........
ILinkManager linkManager= (ILinkManager) teamRepository.getClientLibrary(ILinkManager.class);
IReference source = IReferenceFactory.INSTANCE.createReferenceToItem(buildresult, sourceComment);
IItemReference source= IReferenceFactory.INSTANCE.createReferenceToItem(workitemHandle);
ILinkFactory.INSTANCE.createLink(BuildLinkTypes.INCLUDED_WORK_ITEMS, source, target);
linkManager.saveLink(link, monitor);


You can find the source, I grabbed the code below from the WorkitemPublisher class, if you set your environment up like described int the Extensions workshop: https://jazz.net/library/article/634

Please note, if you develop for Plain Java API, you can setup the project as plugin project, then add the Library and use the PDE tools to locate references. For deployment you would leave out the plugin.xml

Not sure if you still need to save the modified work item. Here would be some code for that too:


IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.SMALL_PROFILE, null);
IWorkItemWorkingCopyManager wcm = workItemClient.getWorkItemWorkingCopyManager();
wcm.connect(workItem, IWorkItem.FULL_PROFILE, null);

try {
WorkItemWorkingCopy wc = wcm.getWorkingCopy(workItem);

wc.getWorkItem().setHTMLSummary(XMLString.createFromPlainText(summary));
IDetailedStatus s = wc.save(null);
if (!s.isOK()) {
throw new TeamRepositoryException("Error saving work item",
s.getException());
}
} finally {
wcm.disconnect(workItem);
}

System.out.println("Modified work item: " + workItem.getId() + ".");

Your answer


Register or to post 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.