TeamCity download build artifacts based on the branch
Hi Team,
We are recently upgraded to TeamCity Professional 2018.1.3 (build 58658) from 9.1.7. I have created a root VCS setting which is configured as parameter, rather than hard coded value as shown
In our build configuration ( Consider it as A) we using the %BRANCHTOBUILD% parameter which tell which branch to pull from GIT source control during build, in this case via TeamCity's custom dialog developer can provide the desired branch to build, or by clicking the "Run" button the default value will be fetched as "refs/heads/master" as shown

The above build configuration works as expected where we can run the desired branch to build either from custom dialog or just clicking run button.
Now we have another similar build configuration ( Consider it as B) which is pointing to another GIT repository. We have now our two more build configurations out of which one will package (Consider is C) and another will deploy (Consider it as D) based on the output of the above build configurations ( build output from A and B).
Now for the build configuration "C" we have configured the artifact dependencies which will allow to use the artifacts produced by build configurations from A and B as mentioned above.
Now the problem we are facing is when ever we pass the feature branch name via custom dialog ( either from build configuration A or B) the build artifacts are not getting downloaded with the following setting for the selected branch, how ever when when we change the value of Branch Build to "<default>" the value is getting populated to refs/heads/master

Is there a way to tell the build configuration in C that instead of default branch get the build artifacts which are being passed as parameter from build configuration A or B .
Please sign in to leave a comment.
Hi,
Sorry for the delay. First of all, may I ask why are you setting the default branch on every run instead of setting specific branches on the default branch and branch spec settings? TeamCity uses the default branch for tracking changes, and changing it constantly forces resources to be used for recalculations. If your intent is to allow users to set the branch, you could just do the same by using the "Changes" tab instead of forcing an actual parameter for it.
It should also be possible to use %teamcity.build.branch% in fields to reference the branch you are trying to build. That would also simplify it.
It would also make sense to consider applying a snapshot dependency which would automatically use a build on the same branch when available, although it would run a new build under some circumstances.