It's all about the answers!

Ask a question

Triggering a build does not work from within an RTC service


Thorsten Ferres (1367) | asked Jan 08 '15, 11:29 a.m.
I am writing a service (using the RTC server-api) that can be used via REST API to trigger builds using a previously created build definition and build engine. But always when I try to trigger such a build via the RTC service, the jazz build engine says

Abandoned orphaned build 'myBuild '. The build engine is about to process another build request and requires that all in-progress builds previously processed by this build engine be abandoned. Please see the build result's log for more information.

and the build log for the build definition says

This build has been automatically abandoned by the build engine 'myEngine'.
This can happen if the build engine stops while it is processing a build, or if it fails to communicate with the server (e.g. due to the server crashing, or a network break).
As a result, the build is left in the in-progress state.

Such builds are automatically abandoned for the following reasons:
1. When the build engine is restarted, new builds will be processed, however the old builds would otherwise remain in the in-progress state indefinitely.
2. As a result the build engine would appear as busy when it is not.

The used build engine is 'myEngine' is 'idle'. When I now do a 'Request Build...' or a 'Request Rebuild...' via my RTC Eclipse client, the build gets executed. I need the build to be executed directly via my RTC service, because I evaluate the build result I and only do further steps in my service if the build completed successfully, which is of course not the case if it is abandoned directly from the JBE.

Accepted answer


permanent link
Nick Edgar (6.5k711) | answered Jan 08 '15, 1:51 p.m.
JAZZ DEVELOPER
Hi Thorsten, which method are you using to request the build? It should only request the build, not mark it as started or otherwise claim it, otherwise JBE will say "looks like there's a build that I was running but I'm not anymore, so I'll abandon it". If it's just requested / queued, then the JBE should pick it up, just like a manual request.

Should also double-check that you don't have two JBE instances using the same engine ID, which can produce the same effect. But if a manual build works OK, this suggests that's not the case.
Thorsten Ferres selected this answer as the correct answer

Comments
Thorsten Ferres commented Jan 09 '15, 10:29 a.m.

I have been using the method

ITeamBuildRequestService.requestAndStartBuild()

to trigger and start the build, which allows to pass the builddefinition as well as the buildengine. Now I am trying to use the method

ITeamBuildRequestService.requestBuild()

which also returns IBuildRequest object but I have currently not found a way to set the buildengine that should be used. When I try to set it directly via IBuildRequest.setHandler(), I get a ImmutablePropertyException, but when I try to generate a IBuildRequest.getWorkingCopy(), I have found no way how to save this working copy again.


Thorsten Ferres commented Jan 09 '15, 10:36 a.m.

When I trying to use the method

ITeamBuildRequestService.requestBuild()

without trying to set the buildengine that should be used, the build request is not picked up by the JBE.


Nick Edgar commented Jan 09 '15, 2:56 p.m.
JAZZ DEVELOPER

When you request the build manually, do you need to specify an engine at request time for it to work, i.e. does the definition have any supporting engines to begin with?


The handler property of a request is the engine that actually picks up the request, so shouldn't be set by the requestor. To direct the request to a specific engine, you should instead specify that when requesting the build. You'll need to use the requestBuild2(IBuildRequestParams), specifying the build definition using IBuildRequestParams.setBuildDefinition, and add the build engine handle to the list given by IBuildRequestParams.getPotentialHandlers().
com.ibm.team.build.common.BuildItemFactory.createBuildRequestParams() is the factory method for the params object.


Thorsten Ferres commented Jan 13 '15, 4:42 a.m.

Hello Nick!

Thank you very much!

Using the

  requestBuild2(IBuildRequestParams)

-method without setting IBuildRequestParams.setStartBuild(true) or trying to start the requested build via
ITeamBuildRequestService.startBuild(IBuildRequest request, String[] properties) the build request was picked up and executed by my JBE.


Nick Edgar commented Jan 13 '15, 12:50 p.m.
JAZZ DEVELOPER

Good to hear.

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.