It's all about the answers!

Ask a question

How to query all build engines and get the build definitions associated to it in Java API?

Karthik Krishnan (8805115162) | asked Aug 09 '17, 5:26 a.m.

I want to analyze the load on each build engines and rearrange some build definitions to some other build engines.

To do this which I want to get all available Build engines in a given PA and then get all build definitions associated to it.

How can i do this with Plain Java API? 

we have 50+ Build engines and doing this manually is tough and also want to do the same in future too.

2 answers

permanent link
Karthik Krishnan (8805115162) | answered Aug 11 '17, 5:11 a.m.
edited Aug 22 '17, 4:49 a.m.

I found and this is mostly what I need. 

With the piece of code in the above link, the following code will give all the build definitions from the Engine.

List<IBuildDefinitionHandle> lstBDefs = buildEngine.getSupportedBuildDefinitions();
for (IBuildDefinitionHandle lBDef : lstBDefs)
     IBuildDefinition bd = (IBuildDefinition)auditableClient.fetchCurrentAuditable(lBDef, ItemProfile.createFullProfile(IBuildDefinition.ITEM_TYPE), null);
     System.out.println(buildEngine.getId() + ";" + buildEngine.isActive() + ";" + bd.getId());

Thanks @Ralph and @sdetweil

permanent link
Ralph Schoon (62.9k33645) | answered Aug 09 '17, 5:40 a.m.

Karthik Krishnan commented Aug 10 '17, 11:43 a.m.

Thanks Ralph for the pointers.

I also found and this is mostly what I need. 

Now that I have the build engines, I am able to get buildEngine.getSupportedBuildDefinitions() just that I am unable o get the ID of the build definition returned. I am exploring that.

Your answer

Register or to post your answer.