Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practice for identical TeamCity builds across different VCS roots

Can anyone tell me what the best way would be to configure TeamCity builds when I want to run identical build configurations, but on different VCS roots?

e.g; I have several 'build & test' configurations for a repository (for each project in the repo), and I want to duplicate all the settings across our master/develop/r1.0/etc branches?

In the past I've just duplicated the entire build config set and changed the VCS root to achieve this, but as the number of branches grows (with more release branches added over time), how can I simplify my configurations and minimise how many places I would need to make changes if something about the build changed?

like image 647
RJ Lohan Avatar asked Jan 27 '15 21:01

RJ Lohan


People also ask

What are VCS roots in TeamCity?

A VCS root in TeamCity defines a connection to a version control system. It represents a set of parameters (paths to sources, username, password, and other settings) that determine how TeamCity communicates with a VCS to monitor changes and get sources for a build.


1 Answers

Here's my point of view to this problem. I think that solution for you is using Build configuration template + parametrization in VCS root. We have about 20 build configurations (1 configuration = 1 branch), made only by two templates and one vcs root. All common stuff for configuration is kept in template. Only few specific params are in configuration itself and you seth them on creation of configuration from template. One of them is branch name which is highly related to configuration name in my case.

Templates are

  1. Continous integration template - where you only want to check projects are building
  2. Release template - Build plus release generation

VCSroot points only to root of source control. Branch parameter of vcs root is set to custom branch parameter that build configuration inherits from build configuration template.

We have branches structured like this

-Master
-Development
-Releases__3.4.1
         |_3.4.2
         |_3.4.3

Master and development are using Continuous integration template, and each new release branch is using Release configuration template. For me the proces of creating new configuration for 3.4.4 branch is like this:

  1. Create new configuration
  2. Select template Choose: Release
  3. Enter name of configuration Enter: 3.4.4
  4. Save
  5. Run build

Point is that Branch name parameter in Release template is like this

%BranchPath%=Release/%ConfigurationName%

For Continuous integration template it would be

%BranchPath%=%ConfigurationName%

Further in VCS root branch is set to %BranchPath% passed in to it from configuration, so VCS can work with both templates, and all 20 configurations And thats all.. :) Hope it somehow helps

like image 192
100r Avatar answered Oct 19 '22 07:10

100r