Change build template in TeamCity

joe picture joe · Sep 7, 2015 · Viewed 7.8k times · Source

How do I change the build configuration template for a project?

Previously my TeamCity project was using a generic build template which is used by 5 other projects. I created a new template by copying an existing template and made changes that are relevant to my project. Now I cannot find a way to using this template in my TeamCity project.

Is there a easier way other than creating a new build configuration and inheriting the newly created build template?

Answer

Rod picture Rod · Sep 8, 2015

Following is mentioned in TeamCity doc:

  • You can create new build configurations based on a template.
  • You can associate any number of existing build configurations with a template: there's the Associate with Template option available from the Actions button at top right corner of the screen.

So, Option 1 you have is to to go through each Build Configuration, detach from old template and attach to the new one.

Option 2 you might want to consider will be to modify your existing template with the new settings instead of creating a copy. This might be suitable if you are only planning on using one template.

Option 3 is to use TeamCity API which allows to read, detach and attach a build configuration from/to a template:

GET/DELETE/PUT http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/template