TeamCity Remote API

Does TeamCity have an API that can be used remotely to be able to list builds and do more than the few special URLs to start a new build? My current plan is to connect to the TeamCity database and get data from it.

I am trying to build a tool that can list build configurations, their status, download artifacts and a few other things.

5 comments
Comment actions Permalink

Jonathon,

There is no such public API for now. Internally, TeamCity uses XML-RPC to communicate between server and IDE plugins/agents, but this is not part of open API since it can change from one version to another. A good approach seems to write own Java plugin for TeamCity that will expose all the necessary information in the appropriate form.

If you choose to pursue the approach you may found useful the sources of a plugin I recently played with: http://svn.jetbrains.org/teamcity/plugins/rest-api/trunk
It is a very early prototype of REST API for TeamCity (on as-is basis, no compatibility declared). If you find it useful and need more features you can describe them and hopefully they can be implemented in the scope of the plugin.

BTW, can you describe the tool in more details? Why do you need it? What will it be used for?

--
Best regards,

Yegor Yarko
Project Manager (TeamCity)
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Nice upside down avatar

I'll take a look at your REST API plugin, it may do what I want.

I'll try to descibe why I am planning to build a tool that connects to TeamCity. Our builds are about 5GB and contain binaries (+more) for devs, as well as installers and ISOs for testers and the rest of the company. Currently we have the artifacts directory of TeamCity shared as a network share because we don't have a better way of downloading them. One problem with the share is that you loose the last successful and last run tags, as well as the directories being named after the build ID not the build number. The plan for the tool is that anyone in our company can see a list of all available builds and can get what they want, whether that be all developer directories, or the ISOs being copied to their temp directory and auto-mounted with virtual drive software. The plan is to be able to remove the artifacts build share because it shows too much of the internals of TeamCity.

0
Comment actions Permalink

Another one of the things I wanted to add to this tool is to display our summary build log live off the build agent. In our build we generate our own summary log because we have hundreds of projects and the console log has way too much information. Before we used TeamCity we used any tail program to tail a log file in a temp directory that was shared on the build machines, but we can no longer do this because the builds can run on any agent and have a random string in the path name.

To implement this feature I was planning on replacing our command script that TeamCity is running with an .exe that will allow the log to be streamed to anyone interested.

0
Comment actions Permalink

Jonathon,

Thank you for the details.

About artifacts, you might be interested in a feature we have filed: http://jetbrains.net/tracker/issue2/TW-4339
Also, we have a request for naming the directories after the build number.

You might consider making the functionality a TeamCity plugin and expose the artifacts list though a page on TeamCity web UI - the links may then lead to appropriate places, not necessarily related to TeamCity.

With the REST plugin I mentioned you can get internal id of the last successful build and then grab the artifacts from the share.

Can you please share your experience after accomplishing the task - was it hard to integrate with TeamCity, what areas need improvements/documentaiton, etc.

0
Comment actions Permalink

Jonathon,

About the log, you might find this thread related to your task: http://www.jetbrains.net/devnet/thread/280648

We have some ideas about a general feature to be able to see content of a file from agent on the web and allow to view it "live". See http://jetbrains.net/tracker/issue2/TW-4353 and related issues. But I am not yet sure whether it can be included into 5.0 or not.

0

Please sign in to leave a comment.