It's all about the answers!

Ask a question

Writing a new Build Engine... - Updating Status and Activity


Andrew Harmel-Law (14612218) | asked Sep 27 '09, 9:47 a.m.
Hi,

I am writing a new Jazz Build engine. I want it to be able to update the status of a build on the Jazz server as it progresses. I have managed to get my engine to find the latest request and notify of the start of this build using TeamBuildRequestClient.startBuild(...)

However, I also want to be able to provide updates on when activities start and complete (such as fetching, compiling etc). I am not sure how to do this. I have obtained the list of build activities from the TeamBuildClient but it is empty and I cannot see how to add my own. I can however see from the Ant examples that these are used in the way I would like to use them.

I would also like to inform Jazz when a build is complete, but when I call the TeamBuildRequestClient.makeBuildComplete(...) method I am told I cannot complete a build which is in the "IN_PROGRESS" state. I am unclear as to how to change this state before I call this method.

I hope you can help.

Thanks in advance.

Cheers, Andrew

6 answers



permanent link
Nick Edgar (6.5k711) | answered Oct 05 '09, 10:16 a.m.
JAZZ DEVELOPER
Yes, that's corrrect.

permanent link
Andrew Harmel-Law (14612218) | answered Oct 04 '09, 5:30 a.m.
In case I wasn't clear above, the activity ID is returned from startBuildActivity, then can be used in the call to completeBuildActivity (as shown in my snippet), or used as the parent activity id for another call to startBuildActivity.


I see. Does this mean that if I'm calling this (startBuildActivity) without a parent activity I leave the latter null?

permanent link
Nick Edgar (6.5k711) | answered Oct 03 '09, 2:15 p.m.
JAZZ DEVELOPER
In case I wasn't clear above, the activity ID is returned from startBuildActivity, then can be used in the call to completeBuildActivity (as shown in my snippet), or used as the parent activity id for another call to startBuildActivity.

permanent link
Nick Edgar (6.5k711) | answered Oct 03 '09, 1:40 p.m.
JAZZ DEVELOPER
From my reading it seems that I can create any activity I want when I start it, and then complete it by passing in the same ID. Is this correct? Also, where do I get the parentId and label values from? Can I det them to whatever I like? I guess not for parentId.


Yes, that's correct. You can also use true for autoComplete, in which case the activity will be automatically completed whenever the next activity is reported (for the same parent), or when the build is completed.

The label arg is the label to show for the activity, so it can be whatever you want. The parent id can be the id for some other activity if you want to group them hierarchically, or pass null for a top-level activity.

permanent link
Andrew Harmel-Law (14612218) | answered Oct 03 '09, 9:29 a.m.
Hi Nick,

Thanks again for your help. Comments inline below...

Hi again,

As I mentioned in my reply to your previous post, I'd really like to understand why you need to write a new build engine.

Hopefully I've answered this on my response to another of your answers.


I also want to be able to provide updates on when activities start and complete

To start/complete build activities, use:

ITeamRepository = ...;
ITeamBuildClient buildClient = com.ibm.team.build.client.ClientFactory.getTeamBuildClient(repository);
String activityId = buildClient.startBuildActivity(buildResultHandle, label, parentId, autoComplete, progressMonitor);
...
buildClient.completeBuildActivity(buildResultHandle, activityId, progressMonitor);


Superb. I'll give this a try. From my reading it seems that I can create any activity I want when I start it, and then complete it by passing in the same ID. Is this correct? Also, where do I get the parentId and label values from? Can I det them to whatever I like? I guess not for parentId.


I would also like to inform Jazz when a build is complete, but when I call the TeamBuildRequestClient.makeBuildComplete(...) method I am told I cannot complete a build which is in the "IN_PROGRESS" state.

What arguments are you passing to makeBuildComplete? It sounds like you're passing true for the buildNotNecessary argument, which is only allowed it the build is not yet started (NOT_STARTED state). Try passing false instead if so.

I got this working, thanks. My problem wasn't in fact that I was passing "true" but that I was trying to communicate with the wrong buildRequest. Once I got hold of the right one I was able to change its state as desired.

Thanks again for all your help. look out for more posts as I get even further down the route of getting this all working...

Cheers, Andrew

permanent link
Nick Edgar (6.5k711) | answered Sep 29 '09, 2:41 p.m.
JAZZ DEVELOPER
Hi again,

As I mentioned in my reply to your previous post, I'd really like to understand why you need to write a new build engine.

I also want to be able to provide updates on when activities start and complete

To start/complete build activities, use:

ITeamRepository = ...;
ITeamBuildClient buildClient = com.ibm.team.build.client.ClientFactory.getTeamBuildClient(repository);
String activityId = buildClient.startBuildActivity(buildResultHandle, label, parentId, autoComplete, progressMonitor);
...
buildClient.completeBuildActivity(buildResultHandle, activityId, progressMonitor);


I would also like to inform Jazz when a build is complete, but when I call the TeamBuildRequestClient.makeBuildComplete(...) method I am told I cannot complete a build which is in the "IN_PROGRESS" state.

What arguments are you passing to makeBuildComplete? It sounds like you're passing true for the buildNotNecessary argument, which is only allowed it the build is not yet started (NOT_STARTED state). Try passing false instead if so.

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.