It's all about the answers!

Ask a question

RTC 2.0 - Requesting a build from server side code


Dan Rivett (1211115) | asked Jun 25 '09, 5:20 a.m.
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



permanent link
Nick Edgar (6.5k711) | answered Jun 30 '09, 3:55 p.m.
JAZZ DEVELOPER
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

permanent link
Dan Rivett (1211115) | answered Jul 01 '09, 8:40 a.m.
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

at com.ibm.cics.service.jazz.server.build.SimpleBuildRequester.run(SimpleBuildRequester.java:194)
at java.lang.Thread.run(Thread.java:810)
Caused by: com.ibm.team.process.common.advice.TeamOperationCanceledException: 'Request Build' failed. Missing required license.
at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.createLicenseNotGrantedException(OperationAdviceManager.java:382)
at com.ibm.team.process.internal.common.util.AbstractProcess.doAdvise(AbstractProcess.java:173)
at com.ibm.team.process.internal.service.ServerProcess.access$1(ServerProcess.java:1)
at com.ibm.team.process.internal.service.ServerProcess$2.run(ServerProcess.java:130)
at com.ibm.team.repository.service.internal.TransactionService$1.run(TransactionService.java:99)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:466)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$1.run(RepositoryDatabase.java:292)
at com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentConnection(ConnectionPoolService.java:328)
at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:378)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:364)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy5.withCurrentConnection(Unknown Source)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:288)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:244)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:74)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:63)
at sun.reflect.GeneratedMethodAccessor174.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:378)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:364)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy37.runInTransaction(Unknown Source)
at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:3341)
at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:3348)
at com.ibm.team.process.internal.service.ServerProcess.adviseAndExecute(ServerProcess.java:128)
at com.ibm.team.build.internal.service.TeamBuildRequestService.requestBuild(TeamBuildRequestService.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:378)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:364)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy146.requestBuild(Unknown Source)
at com.ibm.cics.service.jazz.server.build.SimpleBuildRequester.requestBuild(SimpleBuildRequester.java:171)
at com.ibm.cics.service.jazz.server.build.SimpleBuildRequester.requestBuild(SimpleBuildRequester.java:151)
at com.ibm.cics.service.jazz.server.build.SimpleBuildRequester.requestBuild(SimpleBuildRequester.java:146)
at com.ibm.cics.service.jazz.server.build.SimpleBuildRequester.run(SimpleBuildRequester.java:190)
... 1 more


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

class="com.ibm.cics.service.jazz.server.operations.savechanges.delivery.DeliveryParticipant"
id="com.ibm.unlicensed.cics.service.jazz.server.operations.savechanges.delivery.DeliveryParticipant"
name="Delivery Automation Participant"
operationId="com.ibm.team.workitem.operation.workItemSave">
<extensionService
componentId="com.ibm.unlicensed.cics.service.jazz.server.operations.savechanges.delivery.DeliveryParticipant"
implementationClass="com.ibm.cics.service.jazz.server.operations.savechanges.delivery.DeliveryParticipant">
<prerequisites>
<requiredService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredService interface="com.ibm.team.workitem.service.IAuditableServer"/>
<requiredService interface="com.ibm.team.workitem.service.IQueryServer"/>
<requiredService interface="com.ibm.team.build.internal.common.ITeamBuildService"/>
<requiredService interface="com.ibm.team.build.internal.common.ITeamBuildRequestService"/>
</prerequisites>
</extensionService>
</operationParticipant>

permanent link
Dan Rivett (1211115) | answered Jul 01 '09, 8:44 a.m.
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.

permanent link
Nick Edgar (6.5k711) | answered Jul 06 '09, 11:00 a.m.
JAZZ DEVELOPER
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

permanent link
Dan Rivett (1211115) | answered Jul 06 '09, 3:02 p.m.
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

permanent link
Nick Edgar (6.5k711) | answered Jul 06 '09, 3:55 p.m.
JAZZ DEVELOPER
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.

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.