Problems with startBuildActivity when calling Ant externally
I have a build script implemented in Ruby running under the Jazz Build Engine that adds progress monitoring to a build result by calling Ant tasks via an external Java process.
E.g. in my Ruby script I call Ant like so:
`#{JAVA} -cp #{SOURCE_ROOT}/org.apache.ant/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -f #{SOURCE_ROOT}/com.ibm.devops.site/build/publish_results.xml -lib #{BUILD_TOOLKIT} -DbuildResultUUID=#{@build_result_uuid} -DrepositoryAddress=#{@repository_url} -DactivityIdProperty=#{activity_id} -DautoComplete=#{autocomplete} -Dlabel='#{progress_message}' #{task}`
This works fine when I don't try to use hierarchal progress (i.e. when I don't specify a parentActivityId). Whenever I try to call this and specify a parentActivityId, it always fails with the following message:
BUILD FAILED
com.ibm.team.build.common.TeamBuildException: The build activity with id "run_cookbook" does not exist in the build result.
... even though my logging and the build result clearly shows that the activity with activityIdProperty 'run_cookbook' did get created.
After a couple of hours of trying various things, I'm wondering if the problem is that I'm publishing each build activity in a separate Java process and the Ant task implementation for startBuildActivity stores the activity hierarchy in the Java program memory (meaning the hierarchy gets lost between each of my invocations of java).
Can someone with more knowledge of the build toolkit implementation please comment? Any recommendations on how to use hierarchal activities if you're using a non-Ant build? I'm following the guidance from this wiki page: https://jazz.net/wiki/bin/view/Main/CppBuild
E.g. in my Ruby script I call Ant like so:
`#{JAVA} -cp #{SOURCE_ROOT}/org.apache.ant/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -f #{SOURCE_ROOT}/com.ibm.devops.site/build/publish_results.xml -lib #{BUILD_TOOLKIT} -DbuildResultUUID=#{@build_result_uuid} -DrepositoryAddress=#{@repository_url} -DactivityIdProperty=#{activity_id} -DautoComplete=#{autocomplete} -Dlabel='#{progress_message}' #{task}`
This works fine when I don't try to use hierarchal progress (i.e. when I don't specify a parentActivityId). Whenever I try to call this and specify a parentActivityId, it always fails with the following message:
BUILD FAILED
com.ibm.team.build.common.TeamBuildException: The build activity with id "run_cookbook" does not exist in the build result.
... even though my logging and the build result clearly shows that the activity with activityIdProperty 'run_cookbook' did get created.
After a couple of hours of trying various things, I'm wondering if the problem is that I'm publishing each build activity in a separate Java process and the Ant task implementation for startBuildActivity stores the activity hierarchy in the Java program memory (meaning the hierarchy gets lost between each of my invocations of java).
Can someone with more knowledge of the build toolkit implementation please comment? Any recommendations on how to use hierarchal activities if you're using a non-Ant build? I'm following the guidance from this wiki page: https://jazz.net/wiki/bin/view/Main/CppBuild
3 answers
I figured out what I was doing wrong.
I thought that I was supposed to specify an activity ID when I ran the startBuildActivity task. Now I realize that the activity IDs are always handed back to you essentially after you run startBuildActivity. That's why you specify 'activityIdProperty' instead of 'activityId' - the value of the activityId gets written back to the property specified by activityIdProperty.
I would suggest updating the documentation to provide an example of using a parent activity. The documentation is quite unhelpful at the moment w/r/t using parent activities.
I thought that I was supposed to specify an activity ID when I ran the startBuildActivity task. Now I realize that the activity IDs are always handed back to you essentially after you run startBuildActivity. That's why you specify 'activityIdProperty' instead of 'activityId' - the value of the activityId gets written back to the property specified by activityIdProperty.
I would suggest updating the documentation to provide an example of using a parent activity. The documentation is quite unhelpful at the moment w/r/t using parent activities.
Created Task 174115: Improve documentation around startBuildActivity Ant task to improve documentation around hierarchal progress feedback.
Created Task 174115: Improve documentation around startBuildActivity Ant task to improve documentation around hierarchal progress feedback.
Hi,
We'll have to take a look at the documentation. There is a Wiki page that gives more detail about activities.
Brent Ulbricht
RTC Build Lead