Can waitForTeamBuild Abandon a build?
![]()
Cristian Gheorghe (1●2●2)
| asked Mar 21 '13, 6:51 p.m.
edited Mar 22 '13, 8:47 a.m. by Spencer Murata (2.3k●11●59●71)
I am using Rational Software Architect to launch headless builds via the JBE v4.0 as a scheduled overnight build.
I have a PMR open with Rational regarding issues related to builds that sometimes hang in headless mode under Linux (using RHEL Server 6.2). In the meantime, thought I would start the builds using startBuildActivity combined with waitForTeamBuild, such that I can use the timeout value to essentially have a build Abandoned if it misbehaves and lasts longer than it should, and hopefully in the process populate buildStateProperty with INCOMPLETE such that I can then have a new build triggered, if if find that the build has been Abandoned.
I have put together a quick test. The waitForTeamBuild did work, in the sense that after my timeout value (60 secs for this test) it has triggered, however to my surprise, my buildStateProperty did not get set.
<waitForTeamBuild repositoryAddress="${repositoryAddress}"
userId="${mdmb.user}" passwordFile="${mdmb.passfile}"
buildResultUUID="${zLinuxBuildResultUUID}"
buildStateProperty="zLinuxBuildState"
buildStatusProperty="zLinuxBuildStatus"
statesToWaitFor="COMPLETED, CANCELED, INCOMPLETE"
verbose="true" timeout="60"/>
<echo message="Build state is: ${zLinuxBuildState}"/>
<echo message="Build status is: ${zLinuxBuildStatus}"/>
And I got this in the log.
[echo] Build state is: ${zLinuxBuildState}
[echo] Build status is: OK
The documentation for waitForTeamBuild mentions what code is returned in various states, so I thought that a timeout would cause the build to enter the INCOMPLETE, therefore setting buildStateProperty to INCOMPLETE as well.
RTC4.0 docs --> INCOMPLETE: the build did not complete normally. Also referred to as abandoned.
Since my buildStateProperty is not getting set to anything but the timeout value is honored, I suppose I must be misunderstanding the way I could use the timeout parameter to have a build Abandoned. In fact, now that I think about it, the build is actually not even been abandoned, since it does continue running on the server, which in turn would mean that if my build is hung, I could not even get another build started since only one build definition can run at any one time. I suppose I am looking for a way to have the build been actually Abandoned on a timeout value if I am to be able to kick start a new build via a new build definition.
Any ideas/advice would be very appreciated, thank you.
|
2 answers
![]()
It appears waitForTeamBuild only sets the build state property if one of the expected states has been reached, not in the case of a timeout. It may have been done that way so the script can detect the timeout case, i.e. the state property is unset.
That said, it does seem problematic that there's no way to get the current state in the case of a timeout. FYI the state would still be IN_PROGRESS. You can probably just assume that if it's not one of the states you list, it's still IN_PROGRESS.
As for actually marking the build as abandoned, we apparently have no Ant task to do that, unfortunately. We have the completeTeamBuild task, but that's for normal completion, and does not support abandon. I've opened enhancement request Provide a way to abandon a build via Ant task (260590)
It could also be done via the Java client API. The relevant API is:
com.ibm.team.build.client.ITeamBuildRequestClient.makeBuildIncomplete(IBuildResultHandle, String[], IProgressMonitor)
|
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.