REST API: Get currently running builds or agents?

Hello,

I want to determine via REST API is any Build Agent currently busy or not
So I'm trying to get builds or agents like:
http://server/httpAuth/app/rest/agents - but returns only static properties of agents
or http://server/httpAuth/app/rest/builds - returns only finished builds

Is it a way to get current state of agent(s) or builds?

Thanks

P.S: TeamCity Professional Version 5.1.3 (build 13506)

4 comments

Sergey,

There is no ability to get neither running builds nor agent's current build via REST API for now.
Feel free to file a feature request in our tracker. What information do you need to receive?

BTW, can you describe why do you need the ability?

0

Thank you Yegor for quick response!

The idea was to synchronize test sessions in order to reuse existing installations of our app
We want be sure that second test session will work against 'free' app (but not one that currently used by other test session)
We plan to store somewere near an application a build-id or agent-id of test session (some lock flag) and check it before starting another session.
Of course a test session will clean such lock at end of tests, but we need to cover cases of canceled or crashed builds

Thank you

0

Sergey,

It seems you can try to implement this as a TeamCity Java/JRuby/Groovy plugin that on buid starting will add a property to the build with a value pointing to a free "app".

BTW, there is a bit alike case that is covered by a plugin, see the comment. It does not pass any properties and just limits the builds running simultaneously, but I guess it can be modified to go through the running builds figuring out what resources they are using and then passing a free resource id into a new build.

0

Thank you

I will keep in mind this option

Is there a sample or doc of groovy plug to start with?

Rgds,
Sergey

0

Please sign in to leave a comment.