Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Completing a Build when Build Isn't Necessary

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?

0 votes



3 answers

Permanent link
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

0 votes


Permanent link
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?

0 votes


Permanent link
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());

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 22 '10, 4:38 p.m.

Question was seen: 4,832 times

Last updated: Feb 22 '10, 4:38 p.m.

Confirmation Cancel Confirm