joe
joe

Reputation: 311

Change build template in TeamCity

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?

Upvotes: 9

Views: 10718

Answers (2)

Rainer
Rainer

Reputation: 861

There is an option 4: If you have the settings in a git-repo, then you can checkout that git-repo, search and replace all ref occurrences of the template-id with new template-id found in

<settings ref="old-template-id">

Then commit and push the new xml files to teamcity repo.

After around 3-4 minutes, the new configuration is applied by teamcity automatically

Upvotes: 3

Rod
Rod

Reputation: 1571

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

Upvotes: 14

Related Questions