How do you deliver the snapshot created by a build to the stream?
![]()
Daniel Reilly (143●13●19)
| asked Jan 20 '15, 11:27 p.m.
edited May 30 '16, 7:12 p.m. by David Lafreniere (4.8k●7) We are using EE dependency builds which do not have the post-build option to deliver the snapshot.
I wrote an ant task that uses the api to do the deliver, but nothing happens -- no errors, no messages, no delivery. With the CLI you have to add -o option to make it work. Do I need something special using the API to duplicate the -o option? This will make the CLI do the delivery: <!-- ScmDeliverSnapshot Macro --> <macrodef name="ScmDeliverSnapshot">But, I can't use this with EE or JBE on zOS. CLI doesn't like the parms, must be backleveled. Here's the deliver code which does not deliver: // Search for stream IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance().setKind(IWorkspaceSearchCriteria.STREAMS); // Verify one stream if (streamWorkspaceHandles.size() == 0) { The syncReport.outgoingBaselines() = 3 before and after code executes. Completes without any message saying why deliver failed. |
Accepted answer
![]() I got this to work using a JBE on zos unix system by changing macro to use <ant line=...> format: <!-- ScmDeliverSnapshot Macro -->
Still would like to know how to get API to handle situations like this though. djr Ralph Schoon selected this answer as the correct answer
Comments I have these examples: https://rsjazz.wordpress.com/2013/09/30/delivering-change-sets-and-baselines-to-a-stream-using-the-plain-java-client-libraries/
|
3 other answers
![]()
I was also struggling with a similar problem with incoming baselines and change sets and it's really important to understand that:
1) if you're dealing with changeHistorySyncReport.incomingBaselines() after a IChangeHistorySyncReport with WorkspaceComparisonFlags.INCLUDE_BASELINE_INFO then you've to consider ONLY the change sets from changeHistorySyncReport.incomingChangeSetsAfterBasis() because changeHistorySyncReport.incomingChangeSets() gives you ALL the Change Sets, even those already pointed by the baselines
2) you may accept ONLY 1 baseline per component so you may not do all in a single shot
sourceWorkspaceConnection.accept(
AcceptFlags.DEFAULT,
targetWorkspaceConnection,
changeHistorySyncReport,
incomingBaselineHandles,
incomingChangeSetAfterBasisHandles,
progressMonitor);
|
![]()
Reading the notes from Evan you could end up with a code like this where you cycle for every component of the source workspace
IChangeHistorySyncReport changeHistorySyncReport = sourceFlowNodeConnection.compareTo( targetFlowNodeConnection, WorkspaceComparisonFlags.INCLUDE_BASELINE_INFO | WorkspaceComparisonFlags.INCLUDE_EMPTY_BASELINES, Collections.EMPTY_LIST, /*excludedComponents*/ progressMonitor); List<IComponentHandle> componentHandles = changeHistorySyncReport.localComponents(); //FOR EVERY COMPONENT (note that some components may not be mapped in the target workspace) for(IComponentHandle componentHandle : componentHandles) { //IMPORTANT from API desc: The order of the baselines in the result reflects the //order in which they were bases in the local history, // in reverse chronological order. List<IBaselineHandle> outgoingBaselineHandles = changeHistorySyncReport.outgoingBaselines(componentHandle); //IMPORTANT from API desc: The order of the change sets in the result reflects their // relative order in the local history for that component. List<IChangeSetHandle> outgoingChangeSetAfterBasisHandles = changeHistorySyncReport.outgoingChangeSetsAfterBasis(componentHandle); //DELIVER ONLY POSSIBILE LATEST BASELINE FOR COMPONENT AND CHANGESETS ON TOP if (outgoingBaselineHandles.size() > 0) { try { sourceWorkspaceConnection.deliver( targetWorkspaceConnection, changeHistorySyncReport, Collections.singletonList(outgoingBaselineHandles.get(0)), outgoingChangeSetAfterBasisHandles, progressMonitor); } catch (TeamRepositoryException e) { log.error("FAILED delivery last baseline and change sets",e); throw new SnipException("FAILED delivery last baseline and change sets",e); } } else { try { sourceWorkspaceConnection.deliver( targetWorkspaceConnection, changeHistorySyncReport, Collections.EMPTY_LIST, outgoingChangeSetAfterBasisHandles, progressMonitor); } catch (TeamRepositoryException e) { log.error("FAILED delivery change sets only",e); throw new SnipException("FAILED delivery change sets only",e); } } } |