VCS Root OR Artifact Dependencies



I have a number of build chains that look like

A -> B -> C

For projects where I have a git vcs root, my first build config A is one to generate the short git hash for the latest commit. The next build B (usually "compile code/package") uses this for version/build numbers. C is "Deploy".

Both A and B have the same vcs root in their configurations (although A doesn't check anything out). C has no vcs root but has a snapshot dependency on B and a vcs trigger with "trigger on changes in snapshot dependencies" checked. B has a snapshot dependency on A.

This means the whole chain is triggered on any changes to the vcs root.

My question is: Is it better practice to only use the VCS Root in A, check everything out and provide the source as artifact dependencies to B?


Cheers :)


Hello Pete,

The recommended approach is to attach VCS root to the build configuration B and checkout out sources in this build configuration. As far as you configured snapshot dependencies, all builds in chain will use the same revision of the sources.

Build artifacts are files produced by a build and stored on the TeamCity server. Please do not use artifact dependencies to share VCS sources.


Many thanks Alina.

Just to be clear, both A and B will have the VCS root attached?

Cheers, Pete


If you do not need any sources to be checked out for the build configuration A, then there is no need to attach VCS root to this build configuration.

If in C you have "trigger on changes in snapshot dependencies" configured and a commit is made in the VCS root attached to B build configuration, then the [whole build chain]( will be added to the queue.

If you want build A to be always started, then disable "Do not run new build if there is a suitable one" in snapshot dependency in build configuration B.


I don't need to check anything out, but I _do_ need to access the %build.vcs.number% parameter so I can generate a short hash from it.

If I don't have the vcs root attached to A, then the %build.vcs.number% parameter is not available to the build configuration. I guess this is another situation where the vcs root needs to be attached, regardless of whether anything is being checked out. 


In this case you can attach VCS root to build configuration A, or generate a short hash as a first build step in build configuration B.


I'll take the former option thank you. I wish to use the build number in the Assembly Info Patcher which, I believe, runs before any of the build steps.


Yes, Assembly Info Patcher runs before all the step, so the first approach is suitable in your case.

Happy building!


Please sign in to leave a comment.