Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce duplication of similar build configurations?

Tags:

teamcity

I have several projects that I'd like to have in separate build configurations with slightly different configurations:

  • VCS source and build triggers (i.e. the only difference is which subdirectory of the projects root dir to use)
  • build steps (the first few are the exact same, but the last few may vary depending on how the unit tests are to be run, dependencies, etc.)

That's it. I looked into Build Configuration Templates, but it seems that does not allow the flexibility of specifying custom build steps or extra VCS roots.

Really I'm just looking to not have to manually copy the (several) build steps from our initial project's build configuration into several more configurations, and to have to maintain them all when things change. It seems there should be a better solution?

like image 766
jwalk Avatar asked Jul 09 '13 20:07

jwalk


1 Answers

I've wondered this as well, but the bits I've found online suggest you favor the redundancy instead of trying to reuse one configuration across your multiple branches or projects.

However, all of that was before version 8 was released, which introduces the ability to extract a meta-runner

Their blog from April 13, 2013 provides a good summary of what they are and how they differ from templates.

Meta-runner

Meta Runner is a powerful feature providing a promising new way for customizing TeamCity and making it even more people-oriented. To understand it, let’s consider an example.

Imagine you have some repeated task used over and over again across different build configurations. The task is defined as one or more build steps, based on built-in runners, like Ant or command line. Most likely you’d want to reuse this task easily across several build configurations. You can’t do this with templates because template enforces you to share the same settings across different configurations which is not always possible. A solution which we propose is to extract Meta-runner out of these steps, see how it works in release notes.

I have yet to implement this, but I will be testing it out soon. It makes me think that you should be able to pass the repository in as a parameter, but I am not sure.

like image 189
Damon Avatar answered Sep 29 '22 13:09

Damon