Build specific matching branch in dependency from parent

I have a build (A) that has a dependency (B).  Both A and B have their own git repos.  When I trigger a build from A, B is also built.  Life is good.

However, I have many feature branches in A's repo.  Sometimes, these correspond to identically named branches in B's repo.  What I would like is for the following:

--A build for branch cool-new-feature is triggered on A.
--Before dependency B is built, TeamCity checks to see if cool-new-feature is also a branch in B's repo.  If yes, then build it; if not, build master (default).

Does anybody know if this is possible, and if so, how?  Thanks!

4 comments
Comment actions Permalink

Hi Wayne,

Snapshot dependencies with feature branches works exactly the same way as you described. All the builds up the chain are marked with the same branch. If their VCS roots have the branch and it is not excluded by their branch specification, the branch will be checked out. Otherwise the default branch is checked out.

0
Comment actions Permalink

Hi Alina; thanks for the reply.

Unfortunately, that is not happening.  Maybe I don't have it configured properly?  

Either way, the dependency build (B in my example above, set as a snapshot dependency) just keeps having master built (and reuses the same build there, as nothing in master has changed).  Even in the build log for it, I see references to master, but nothing to the branch with the same name as the dependent build that kicked it off (here, A).

Any other ideas of places/things to check?  We are strongly considering a move to TeamCity away from Jenkins, but this is a real sticking point.

0
Comment actions Permalink

The example of setup:
Build configuration B, VCS root:
default branch: +:refs/heads/master
branch specification: +:refs/heads/*

Build configuration A, VCS root:
default branch: +:refs/heads/master
branch specification: +:refs/heads/*
Snapshot dependency on B build configuration.

In this case, if you start build configuration A on branch "develop" and branch with the same name exists in build configuration B, then the B will fire on branch "develop". If there is no branch with this name in build configuration B, it will start on default branch, "master" in this case.

0
Comment actions Permalink

Thank you so much, Alina! That was it! (Specifically, the branch specification on B, the dependency)

0

Please sign in to leave a comment.