Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I upload TeamCity definitions as XML?

Tags:

teamcity

TeamCity appears to store the definitions for builds, projects, templates etc as XML internally.

This is exposed in the "Administration > Audit" view where you can see diffs that people made to individual configurations, at URLs like http://teamcityserver/admin/settingsDiffView.html?id=project:project10&versionBefore=8&versionAfter=9&actionId=3151

I'd like to manage a TeamCity setup partially from outside the web interface - e.g. for example keep the build definitions in version control and perhaps programmatically generate them.

Is there any way I can directly upload definitions in this format (or any similar alternative)? I'm aware that there are various APIs and extension points to TeamCity but haven't managed to find any that gives direct access to anything like this.

I can live with the format changing with TeamCity versions if necessary - it would be a reasonable price to pay for the other benefits.

like image 333
GS - Apologise to Monica Avatar asked Sep 25 '13 10:09

GS - Apologise to Monica


1 Answers

For TeamCity 9.x and newer

As reported by Ganesh in the comments to this answer, an option was added in 9.x that supports changes and versioning through Source Code Management (SCM) tools. Please see his answer for 9.x and beyond.

For TeamCity 8.x and older

It might not be the "approved" way, but you can edit the project files on disk, and those changes will appear in your build configs. I have successfully edited them outside of the Web UI after they were created.

So, you could probably open that folder up as a restricted network share or set up ssh.

You'll find it at $TeamCityData/config/projects/ and then they are stored in subfolders such as $projectName/buildTypes/$buildFile.xml

An example is: E:\TeamCityData\config\projects\CSandbox\buildTypes\CSandbox_Project1TrunkBuildUnitTest.xml

like image 160
Damon Avatar answered Sep 30 '22 04:09

Damon