I have a situation where I have to make several copies of a project containing many build configurations, which again are based on many templates.
When making a copy of the project, I find that all the new build configurations are all linked to the old templates.
Now I'm looking for a way to clone and rename the templates within the new project, so that I can change the few nessarry parameters (such as dependencies) embedded in templates to fit the new projects.
The templetes used in these configurations contains about 90% of the parameters used for the a configuration, the last 10% are in the configurations, aditionally about 5% of the template parameters (randomly distributed in the template) are overwritten by the configurations. As far as I can see, this makes it really hard work to simply detatch the template and following create a new template and reapply that template to all the new configurations.
As far as I can see, no method exists for this in the TeamCity GUI, but could I perform it by editing the XML directly?
I'm looking forward for any hints.
Found out it's not possible within the current TeamCity implementation - and some of the issues dealing with this on the issue-tracker are dated back to 2008, so it's not likely to be fixed.
I then proceded to hack the XML directly.
Quick comments on the method:
Configuration data is located in folders at %TEAMCITY_DATA_PATH%
The source project contains <template> </template> sections. These sould be copied manually to the destination.
When copying, update the description and the id number. Use grep to find all template id's in use in all projects (searched for id=.btTemplate* ), and then use numbers not in use.
Then update all references to the old templates to point to the new ones. Use grep to search for =.bt[0-9] inside the source folder to find them.
The places I found to update are (search-replace works fine.):
<param name="dependsOn" value="bt2184" />
<dependency sourceBuildTypeId="bt2184" cleanDestination="true">
It's 20 minutes work added to every project copy, so it would really be nice to have it implemented in TreamCity.