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

Gracefully terminating an inprocess build

Is there a recommended way to terminate an in-progress ant build from within the build itself?

The behavior I'm looking for is similar to the "buildNotNecessary" flag on CompleteBuildTask or the Jazz SCM "build only if changes were accepted", but executed by the ant build script itself. I'm currently emulating this function by calling:


getTeamBuildRequestClient().makeBuildIncomplete(getBuildResultHandle(), IBuildResult.PROPERTIES_REQUIRED, getProgressMonitor());
getTeamBuildClient().delete(getBuildResultHandle(), getProgressMonitor());


from a custom ant task and then invoking the ant <fail> task. The build is correctly terminated and the result deleted, but the build loop then catches and writes an exception after the ant build completes (because it attempts to call makeBuildComplete on a build result that has already been deleted).

Is there a graceful way to accomplish this via the Java API from within an in progress ant task? Is there something that would allow me to notify the build loop via ant properties that the build should be abandoned / removed? Or is this something I should be attempting via a pre-build participant (stop the build before it starts) or post-build participant (detect that an ant property has been set and delete the build result after completion)?

0 votes



2 answers

Permanent link
claycole wrote:
Is there a recommended way to terminate an in-progress ant build from
within the build itself?

I don't think so. I haven't explored doing it through Java. There is
no way to do it through Ant. A few months ago I opened enhancement
87583
(https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/87583)
requesting an Ant task to do that.

0 votes


Permanent link
JBE should handle this better. After the script returns, it should check whether the build result has been deleted, or has already been completed, before trying to upload the build log and mark the build as completed.

I've filed 96664: BuildLoop should check for deleted / completed build after running script for this, and subscribed you.

See also 95289: Ant task to delete a build result.

Regards,
Nick

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: Oct 11 '09, 4:37 p.m.

Question was seen: 7,303 times

Last updated: Oct 11 '09, 4:37 p.m.

Confirmation Cancel Confirm