How to programmatically obtain snapshot details from respective Build Results?
Hi,
We wanted to programmatically compare snapshots by providing the build IDs to which they are respectively attached. To compare the snapshots we can use the RTC Command Line Interface. But what do we use to get the snapshot ids from the build ids. Obviously for this we would first need to populate a list of build results for a particular definition. This can be achieved using the REST API. (/jazz/resource/virtual/build/results) However we are not able to find the id of the snapshot in the detail provided by the response above. Are we missing something here or is this not possible by using REST API? If not possible? How do we get the snapshot from the build id? Are there other ways? Regards, Arun |
3 answers
Hi,
If you have the build result uuid then you can retrieve the build snapshot by getting the build contributions, following rest call should get the data
<url>/resource/virtual/build/result/<build result uuid>/contributions?type=buildSnapshot
the result in JSON format would be like
{
"contributions":[
{
"contribution":{
"impactsPrimaryResult":false,
"label":"snapshot rtc.601_20150630-2158",
"internalId":"_n_GaIB-UEeWRX78FKa6vpQ",
"extendedContribution":{
"etag":"_nuOFgB-UEeWRX78FKa6vpQ",
"stateId":"_nuOFgB-UEeWRX78FKa6vpQ",
"uri":"itemOid\/com.ibm.team.scm.BaselineSet\/_nuB4QB-UEeWRX78FKa6vpQ",
"itemId":"_nuB4QB-UEeWRX78FKa6vpQ",
"com.ibm.team.repository.typeName":"com.ibm.team.scm.BaselineSet"
},
"extendedContributionTypeId":"buildSnapshot"
},
"contentUri":"",
"etag":null,
"buildResultItemId":"_nDl0IB-UEeWRX78FKa6vpQ",
"uri":"virtual\/build\/result\/_nDl0IB-UEeWRX78FKa6vpQ\/contribution\/_n_GaIB-UEeWRX78FKa6vpQ",
"com.ibm.team.repository.typeName":"com.ibm.team.build.rest.BuildResultContributionDTO"
}
],
....
....
}
|
You can also use the generateChangeLog Ant task:
http://www-01.ibm.com/support/knowledgecenter/#!/SSYMRC_5.0.2/com.ibm.team.build.doc/topics/r_generatechangelog.html
|
Is there a way to obtain the snapshot information having the BuildResult (or BuildDefinition object) using Java Plain API?
|
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.