requesting build using rtc server side api
Hello Everyone,
I am using RTC 606.
I have written server side plugin to request build multiple times when the work item state changes from Design to Development.
As In my case when the factory CR work item state changes from Design to Development its childs APP CR work item also moved from design to development and when APP CR moved from Design to Development then plugin will request build for multiple APP CR means if factory CR has 2 APP CR 2 times build should be requested. one build request per APP CR.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Comments :
code where build method invoke for requesting build
(if factory CR work item has 3 APP CR this plugin will invoke 3 times when APP CR moved from design to Development)
///////////
if(finalBudgetValue.equalsIgnoreCase(OpexLiteralVal))
{
//Find Stream Name
String MajorMinorStream=appNameValue+"_"+TQCMajorStream;
build(wis, iac, workingCopy,sourceWIProjectArea, BuildDef, crid, appNameValue,MajorMinorStream, operation, participantConfig,logger, collector, monitor);
}
////////////////////////////////////////////////////
Requesting build method code
---------------------------
protected void build(IWorkItemServer wis, IAuditableCommon auditableCommon, IWorkItem workingCopy, String Projectarea, String buildId, String crid, String appNameValue, String majorMinorStream , AdvisableOperation operation, IProcessConfigurationElement participantConfig, Logger logger, IParticipantInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException {
Object data = operation.getOperationData();
ISaveParameter saveParameter = null;
saveParameter = (ISaveParameter)data;
if (data instanceof ISaveParameter) {
saveParameter = (ISaveParameter)data;
IAuditable auditable = saveParameter.getNewState();
if (auditable instanceof IWorkItem) {
ITeamBuildService buildService = (ITeamBuildService)getService(ITeamBuildService.class);
IBuildDefinition buildDef = buildService.getBuildDefinition(buildId);
IBuildProperty buildProp = BuildItemFactory.createBuildProperty();
//String duID = crid;
//this.map.put("CRName", duID);
buildProp.setKind("com.ibm.team.build.property.string");
IBuildProperty[] buildProps = new IBuildProperty[1];
//Iterator GetBuildId = this.map.entrySet().iterator();
logger.debug("Newly created build property array:"+buildProps);
int i=0;
// while (GetBuildId.hasNext()) {
if(i==0)
{
//Map.Entry pair = (Map.Entry)GetBuildId.next();
//GetBuildId.remove();
logger.debug("first property"+i);
String BuidKey1 ="CRName" ;
String BuidValue1 =crid;
buildProps[i] = BuildItemFactory.createBuildProperty(BuidKey1, BuidValue1);
logger.debug("first build property array:"+buildProps[i]);
i++;
}
logger.debug("RTC Build is going to request");
ITeamBuildRequestService brService = (ITeamBuildRequestService)getService(ITeamBuildRequestService.class);
logger.debug("brservice object:"+brService);
IItemsResponse response = brService.requestBuild(buildDef, buildProps, null, false, false);
logger.debug("RTC Build is requested and response is"+response);
}
}
}
}
so I observed that for 2 APP CR build requested only once but I checked in logger and also I have tested plugin in jetty server that plugin executed 2 times and also code does not move into catch.
Please check the code for requesting the RTC build and let me know why its not requesting build multiple times.
Regards
Pallavi Deore
One answer
How the server API to request builds works is explained in https://jazz.net/library/article/1000. The code above is pretty much unreadable.
Comments
I should also mention that I have observed customers overloading and bringing down their CCM servers with enormous amounts of builds launched against their CCM servers.
The amount of build jobs and the frequency they run, as well as rthe related SCM activities, is a critical contributor to the CCM server load and can be a main reason for performance degradation and outages.