RTC 2.0 - Requesting a build from server side code
![]()
I've created a WorkItem save participant and I want it to kick off a build if it's saved in a particular state.
This is very similar to the post earlier this year: https://jazz.net/forums/viewtopic.php?p=12313 I was just wondering if this also applies to RTC 2.0 or whether there is now a public API to allow build requests on the server, like on the client? Also is it possible for a few example lines of code demonstrating how to invoke a build from the server side. Many thanks, Dan |
6 answers
![]()
Hi Dan,
The situation is basically the same as in 1.0 as far as API for Build goes. The existing API is all client-side. The main focus for Build for 2.0 was on the web UI. There were some enhancements made to the Build REST service, in support of the web UI (it's implemented in TeamBuildRestService for URLs like {repo}/resource/virtual/build/definitions etc.), but this should be considered internal too. Here's a snippet showing how you could request a build from another server-side service (I'm assuming you know about how to declare a service extension and its required services). String definitionId = "some.build.definition"; IBuildDefinition definition = getService(ITeamBuildService.class).getBuildDefinition(definitionId); getService(ITeamBuildRequestService.class).requestBuild(definition, null, null, true, false); The signature for requestBuild is: IItemsResponse requestBuild(IBuildDefinitionHandle buildDefinitionHandle, IBuildProperty[] newOrModifiedBuildProperties, IBuildProperty[] deletedBuildProperties, boolean allowDuplicateRequests, boolean personalBuild) Nick |
![]()
Hi Nick,
Many thanks for your reply, it was very useful indeed. The build request is now being invoked from my Operation Participant, however I'm getting an error as show below stating 'Missing required license' Exception in thread "Thread-73" java.lang.RuntimeException: Unable to request build successfully Any idea what is causing it and how to resolve it? I saw this post and changed my WorkItem Save Changes Operation Participant to start com.ibm.unlicensed.... but I'm not sure if this is what the post meant and I'm a bit confused. Any help would be really useful. I've included a snippet of my Operation participant declaration in the plugin.xml <operationParticipant |
![]()
The text seems to be truncated on the right, so the error message is:
com.ibm.team.process.common.advice.TeamOperationCanceledException: 'Request Build' failed. Missing required license. |
![]()
This indicates that the user invoking the TeamBuildRequestService.requestBuild operation does not have a license assigned that allows that operation. If the user is a human, assign a Developer license. If it's a build user/robot, assign a Build license.
License assignments can be done via the admin web UI http://{serverAddress:port}/admin or via the Eclipse UI: - right click on repository in the Team Artifacts view - Administer > Open Users... - choose the user You need to have Admin privileges to view/change licenses though. If this isn't clear, see the help topic: Administering > Administering the Jazz Team Server through the Web interface > Managing users > Managing client access licenses |
![]()
Hi Nick,
Thanks for the reply. I'd originally thought as you said, however the problem is, is that although I can request a build from RTC fine (by selecting the build under the builds tree item in the Team Artifacts view), when I save a work item (and so invoke the work item save participant) I get the "Missing required license" error. Any ideas why it works when I explicitly request a build, but not when I save a work item which requests one programmatically? Both actions are invoked by the same user who has a Developer license. Many thanks Nick, Dan |
![]()
Sorry, I'm not sure. It seems like it should work. The best I can suggest is to set a breakpoint in LicenseService.assertLicense (called in AbstractProcess.doAdvise) and step through it to see what condition is failing.
|