Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import/Export TeamCity build configuration from one server to another

What's the best way to move a single TeamCity build configuration from one server to another?

I have a local instance of TeamCity that I test builds on. Then when the build is sufficiently mature, I manually create it (eyeball-copy) on our main TeamCity server.

Is there an Export & Import feature that will do this for me?

like image 691
Ace Avatar asked Apr 22 '14 15:04

Ace


People also ask

How do you copy a TeamCity build?

To copy, move or delete a build configuration, use the Actions menu in the upper right corner of Build Configuration Settings.

How do I import a project on TeamCity?

On the target TeamCity server: Go to the Server Administration area and select Project Import on the left. Upload your project settings and follow the wizard. When the import finishes, TeamCity will display the results.

How do I use custom build in TeamCity?

To run a custom build with specific changes, open the build results page, go to the Changes tab, expand the required change, click the Run build with this change, and proceed with the options in the Run Custom Build dialog. Use HTTP request or REST API request to TeamCity to trigger a build.


3 Answers

Unfortunately there is no such thing. TeamCity 8 made the situation a little bit better though by introducing a Build Id format (project name + build config name, can be overwritten) that makes it feasible to "hand copy" build configurations:

Basically under the hood all your TeamCity build configurations are really just XML files in the BuildServer\config\projects\ folder and sub folders. While I haven't tried this you should be able to just copy your project folder or build config XML to the appropriate destination on your new TeamCity instance if the ids don't collide. At the very least you can definitely overwrite existing projects with updates this way (something I have done in the past to dynamically change build configs "on the fly").

Of course if your build config depends on other builds / artifacts those ids have to match as well, so either you have to copy those as well or adjust the ids accordingly. Same goes for agent requirements.

Edit:

With TeamCity 9 out now there's a much better option to move projects between TeamCity servers built in:

Now TeamCity provides the ability to move projects among servers: you can transfer projects with all their data (settings, builds and changes history, etc.) and with your TeamCity user accounts from one server to another. All you need to do is create a usual backup file on the source TeamCity server containing the projects to be imported, put the backup file into the /import directory on the target server and follow the import steps on the Administration | Projects Import page.

For a full summary see what's new in TeamCity 9.

like image 60
BrokenGlass Avatar answered Oct 19 '22 01:10

BrokenGlass


For TeamCity 9 and above:

  1. Make sure both instances of TeamCity are running the same version.
  2. Export data from TeamCity: Using the web UI on the source machine, go to Administration -> Backup and do a Basic backup. It will tell you the path to the backup file created.
  3. Import data to TeamCity:
    1. On the target server, open the web UI and navigate to Administration -> Projects Import. This will tell you the path to the import directory.
    2. Copy the backup file to the import directory, refresh the web UI, and click 'Configure Import Scope'
    3. Select the projects and categories of data you want to import. Given that the question was just about build configurations, you would uncheck importing users and groups. Click 'Start import'.
like image 19
Martin Eden Avatar answered Oct 19 '22 03:10

Martin Eden


TeamCity 9 has this ability builtin - https://confluence.jetbrains.com/display/TCD9/Projects+Import

like image 2
sppc42 Avatar answered Oct 19 '22 03:10

sppc42