Triggering a build does not work from within an RTC service
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
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
Thorsten Ferres
commented Jan 09 '15, 10:36 a.m.
When I trying to use the method
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!
Good to hear. |
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.