2

We have many projects that are treated, built and deployed the same way and we want to have a unified TeamCity build chain for all of them.

Our build chain should contain:

  • Compilation and testing for pull requests and develop branch.
  • SonarQube analysis for pull requests.
  • NPM publish and autolabel for merged pull requests into develop.

All of the projects are NPM packages that comply with the following:

  • required scripts: install, test, clean, build
  • package.json and sonar-project.properties in the root

We had the idea of using common parametrized builds for SonarQube and NPM publish, since they are agnostic to the project itself, but it looks like TeamCity does not support anything like this unless we replicate chain builds for each project.

Ideally it should look something like this:

Common build chain

The problem here is that if I add triggers for build finish and add dependencies to SonarQube and NPM publish for all of the projects it will require building every project and not only the one that has just been built.

TeamCity provides something like this by being able to duplicate build configurations:

enter image description here

I do not want to have many duplicated builds in the same way I do not fancy duplicated code. Is there a way to create the common build chain or should I move forward and look for a scripted way of generating the latter?

RecuencoJones
  • 2,747
  • 3
  • 22
  • 21
  • There is a related request in TeamCity issue tracker you can vote for: https://youtrack.jetbrains.com/issue/TW-35216. Do you need snapshot dependencies? If you configure only artifact dependencies, then the whole chain won't rebuilt. The second approach that you described will also work. You can use TeamCity templates to simplify the setup. – Alina Mishina Oct 17 '16 at 14:53
  • Yep, I know that I could go with templates and dupes, but we already have 20 libraries and I wouldn't like to have 20 times the same chain copied and pasted... I tried adding Packages A, B and C to 'SonarQube' and 'NPM publish' as Snapshot and Artifact dependencies, the problem here is that it will require that all the dependencies are built and also will attempt to copy artifacts from all the dependencies rather than just the one that triggered the build, overwriting each other... quite a mess. – RecuencoJones Oct 17 '16 at 15:04

0 Answers0