Best Practice for identical TeamCity builds across different VCS roots
Asked Answered
A

1

7

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?

Aldoaldol answered 27/1, 2015 at 21:57 Comment(4)
Do you build and test legacy releases etc? - Personally I use TC @work, but only for mediocre things like "build and test this one release branch and deploy to Testing - then elevate to Production" - I only keep 1 release branch per project. I don't think TC can accommodate what you want in any other way than you already know and use. SorryOxbridge
I'd build and test them once the branch was created, and then any hotfixes in that branch would need to go through same process. There might be 3-4 release branches in play at any one time.Aldoaldol
What version control do you use? As in, what are the different VCS roots?Aniakudo
@psych; Git/Stash, the VCS roots are different branches.Aldoaldol
B
5

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

Battleax answered 5/4, 2015 at 23:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.