It's all about the answers!

Ask a question

Completing a Build when Build Isn't Necessary


Kirk Vogen (12711518) | asked Feb 22 '10, 4:38 p.m.
If not using the JBE, one can implement their own build loop using the Ant tasks. But, how does one cancel a build request using completeBuildTask?

completeBuildTask needs a buildResultUUID, but the task typically called prior to that, getNextTeamBuildRequest, returns a buildRequestUUID.

The only way I know to get a buildResultUUID is to use the startTeamBuild task. But, then calling completeBuildTask (with buildNotNecessary=true) yields an exception since the build would already be in an in-process state.

Is there some way to "convert" a buildRequestUUID into a buildResultUUID without starting the build?

3 answers



permanent link
David Olsen (5237) | answered Feb 23 '10, 12:53 a.m.
JAZZ DEVELOPER
kvogen wrote:
If not using the JBE, one can implement their own build loop using the
Ant tasks. But, how does one cancel a build request using
completeBuildTask?

completeBuildTask needs a buildResultUUID, but the task typically
called prior to that, getNextTeamBuildRequest, returns a
buildRequestUUID.

The only way I know to get a buildResultUUID is to use the
startTeamBuild task. But, then calling completeBuildTask (with
buildNotNecessary=true) yields an exception since the build would
already be in an in-process state.

Is there some way to "convert" a buildRequestUUID into a
buildResultUUID without starting the build?

Unfortunately, there isn't a way to do that. Work item 87583, which is
unresolved and currently unplanned, looks at the problem from a slightly
different point of view, abandoning the build and deleting the build
result after the build has been started. But it's trying to solve the
same problem.

https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/87583

permanent link
Kirk Vogen (12711518) | answered Feb 23 '10, 6:44 a.m.
Thanks for the response. As an alternative, is it possible to programmatically delete a build result?

There is a cancelBuild method on the ITeamBuildRequestClient that allows me to cancel a build when I detect that it isn't necessary. That works great, except that it keeps a canceled build result around. Is it possible to programmatically delete that canceled build result?

permanent link
Kirk Vogen (12711518) | answered Feb 23 '10, 1:04 p.m.
I figured out a solution. It can be done using the underlying Java API.

An instance of IBuildResult returns the IBuildResultHandle instance via the getBuildResult() method. From there, makeBuildComplete method can be called. The end result is that the build request disappears from the UI since it wasn't necessary.

// See Ant task source code to determine how to instantiate three instances below.
// The IBuildResult instance you'll probably retrieve via
// teamBuildRequestClient.getNextRequest(...)
ITeamBuildRequestClient teamBuildRequestClient = someNonNullValue;
IBuildResult buildResult = someNonNullValue;
ITeamRepository teamRepository = someNonNullValue;

IItem item = teamRepository.itemManager().fetchCompleteItem(buildRequestHandle,
IItemManager.REFRESH, new NullProgressMonitor());
IBuildRequest buildRequest = (IBuildRequest) item;
IBuildResultHandle buildResultHandle = buildRequest.getBuildResult();

boolean buildNotNecessary = true;
teamBuildRequestClient.makeBuildComplete(buildResultHandle, buildNotNecessary,
IBuildResult.PROPERTIES_REQUIRED, new NullProgressMonitor());

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.