Retrieving build history using Java API
Albin Joseph (40●3●6●10)
| asked Nov 06 '12, 10:46 a.m.
edited Nov 07 '12, 10:39 a.m. by Ralph Schoon (63.1k●3●36●45)
Hi,
Is it possible to retrieve the build history using Java API? Actually what I am trying to do is to find the name of the snapshots created by the last two builds. So I think the first step to do that is to retrieve the build history. Thanks -Albin |
4 answers
Lauren Hayward Schaefer (3.3k●1●17●27)
| answered Nov 14 '12, 7:46 a.m.
JAZZ DEVELOPER edited Nov 14 '12, 7:48 a.m.
Hi Albin,
Somehow I missed the notification from your last comment. Sorry for the delay! I think you may want to try "buildResultQueryModel.buildDefinition()._eq(query.newItemHandleArg())" instead of "
buildResultQueryModel._eq(buildDefinition.getItemHandle()"
. I'm including the code from a method I have that queries for an individual build based on its label and build definition in case it helps you:
IBuildResultQueryModel buildResultQueryModel = IBuildResultQueryModel.ROOT; IItemQuery query = IItemQuery.FACTORY.newInstance(buildResultQueryModel); query.filter( query.and(buildResultQueryModel.label()._like(query.newStringArg()), buildResultQueryModel.buildDefinition()._eq(query.newItemHandleArg()))); query.orderByDsc(buildResultQueryModel.buildStartTime()); IProgressMonitor monitor = new NullProgressMonitor(); ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class); IBuildDefinition buildDefinition = buildClient.getBuildDefinition(buildDefinitionId, monitor); Object[] parameters = new Object[] { label, buildDefinition }; IItemQueryPage queryPage = buildClient.queryItems(query, parameters, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE, monitor); if (queryPage.getSize() == 1) { return (IBuildResult) teamRepository.itemManager().fetchCompleteItems(queryPage.getItemHandles(), IItemManager.DEFAULT, monitor).get(0); } else { return null; } |
Ralph Schoon (63.1k●3●36●45)
| answered Nov 07 '12, 10:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You might want to look into this article where I get the builds https://jazz.net/library/article/807. Maybe there is something new you can reuse.
What is the issue you are seeing with your expression? Comments
Ralph Schoon
commented Nov 07 '12, 10:47 a.m.
| edited Nov 07 '12, 10:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
And you might want to look at this post too, because that could be what you want: http://ryehle.wordpress.com/2012/06/28/custom-build-result-pruner/
|
Hi Albin,
I'm not sure offhand how much information you can get about a build using the Java API. https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples has examples of how to query for builds, which may help you get started. |