It's all about the answers!

Ask a question

How to access RTC build engine status programmatically.


Bruce Eifler (3912) | asked Nov 01 '13, 12:54 p.m.
We need to be able to pass status back from an ongoing build process that is running in a remote  RTC build engine. We need to find the object that the RTC Build Engine uses to pass back the current build status message to the server/client, i.e. what the user sees in the Progress column of the Builds view upon refresh.  It's most likely an org.eclipse.core.runtime.IProgressMonitor object.  Then we need access to this object so we can update build progress messages.

2 answers



permanent link
Scott Cowan (966310) | answered Nov 05 '13, 9:02 a.m.
JAZZ DEVELOPER
Hi Bruce,

There are Ant tasks available in the build toolkit that allow you to contribute to a build result's progress.  You can read about them in the current release's docs under development here, https://jazz.net/help-dev/clm/topic/com.ibm.team.build.doc/topics/r_enableprogressmonitor.html.  Or you can find the equivalent doc in your release's docs.  Also, notice the other Ant tasks available in that context.

Scott

Comments
Bruce Eifler commented Nov 07 '13, 11:23 a.m.

The available methods are limited to startBuildActivity and
completeBuildActivity.  These seem to provide only two states. Our intent is to provide a more granular update of the status so the user can see the detailed progress of builds through multiple phases. Is the usage of the startBuildActivity
 intended to be called for multiple status updates during the build?


Scott Cowan commented Nov 07 '13, 12:35 p.m.
JAZZ DEVELOPER

You can create child activities to break down the progress of a parent activity, but unlike IProgressMonitor, you cannot divide an activity into units and update the number of completed units.


Bruce Eifler commented Nov 07 '13, 1:06 p.m.

To be more clear.  The update methods available are both ANT tasks.  We are using ANT to execute our external Java code to perform a build.  We would like to be able to send status updates from our Java build processes that would be sent to the user viewable panel on the RTC client.


permanent link
Scott Cowan (966310) | answered Nov 07 '13, 2:34 p.m.
JAZZ DEVELOPER
Hi Bruce,

I couldn't fit this all in a comment to the answer above, so I've created another answer.  Here's an example I whipped up based on the example at startBuildActivity and  Integrating with Jazz SCM and Builds from Hudson and Jenkins . You can see what the progress looks like in the Builds view below.

It looks like,

Progress example
where build.xml contains,
<project name="sample" default="compile">
   <property name="userId" value="ADMIN" />
   <property name="password" value="ADMIN" />
   <taskdef name="startBuildActivity"
            classname="com.ibm.team.build.ant.task.StartBuildActivityTask" />
   <taskdef name="completeBuildActivity"
            classname="com.ibm.team.build.ant.task.CompleteBuildActivityTask" />
   <taskdef resource="net/sf/antcontrib/antlib.xml" /> 
   <target name="compile">
      <echo message="Compiling parent"/> 
      <startBuildActivity label="Compiling parent"
                       activityIdProperty="parentId"
                       buildResultUUID="${buildResultUUID}"
                       repositoryAddress="${repositoryAddress}"
                       userId="${userId}"
                       password="${password}" />
      <sleep milliseconds="1000"/>

      <for list="1,2,3,4,5,6,7,8,9,10" param="num" delimiter=",">
         <sequential>
            <echo message="Compiling child @{num}"/> 
            <startBuildActivity label="Compiling child @{num}"
                                parentActivityId="${parentId}"
                                autocomplete="true"
                                buildResultUUID="${buildResultUUID}"
                                repositoryAddress="${repositoryAddress}"
                                userId="${userId}"
                                password="${password}" />
            <sleep milliseconds="1000"/>
         </sequential>
      </for>
 
      <completeBuildActivity activityId="${parentId}"
                       buildResultUUID="${buildResultUUID}"
                       repositoryAddress="${repositoryAddress}"
                       userId="${userId}"
                       password="${password}" />
   </target>
</project>

Comments
Bruce Eifler commented Nov 18 '13, 5:15 p.m.

We are calling a custom java build process from ANT we need to be able to send back status from within our java code to  provide a more detailed status to our users.
It looks like we should be able to instantiate a TeamBuildClient object and then call it's 
startBuildActivity method. 
The parameters are as follows =>
public String startBuildActivity(final IBuildResultHandle buildResultHandle, final String label,
            final String parentId, final boolean autoComplete, IProgressMonitor progressMonitor)

I think the parm info is available to me from the Ant env except "parentId".  I'm not sure where to get that.

I'm I headed in the right direction here or is there some reason this will not work?

Thanks

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.