Triggering a branch build

If you're familiar with the "Finish Build" trigger:

  • When you load it, you get one set of options.
  • If you select a build configuration which is a multi-branch build, you can select which specific branch you want to trigger from.  Great!  This is the first half of exactly what I'm looking for!
  • ...BUT you can't specify which branch you want to build!

In other words:

Configuration A has branches 1, 2, and 3

Configuration B has branches X, Y, and Z

A build in A.1 needs to trigger B.X, but A.2 should trigger B.Y instead of B.X

There doesn't seem to be any way to do this, at all.  I can specify branches in the VCS trigger, and in the Finish Build Trigger it's half way there, but it's more or less completely useless because it won't let me trigger a specific branch (so it only triggers the default branch, which is usually incorrect.)

Without this feature, it seems like the multi-branch builds are basically missing something.

Another example (if you didn't follow above and want more examples), from Java/Maven this time:

Maven trigger detects new published artifact 1.2.3 and triggers a release branch build.
Maven trigger detects new published artifact 1.2.3-SNAPSHOT and triggers a dev branch build because the release branch isn't supposed to use snapshots.

Repeat for C#/NuGet.

What do you think?  Is this something I can get some traction on?

PS: I've opened a Youtrack ticket (TW-39588 for this which was closed as a duplicate of another ticket (TW-6439), then someone else from JetBrains told me to come to the forum because it didn't belong either.  Argh! :)

1 comment
Comment actions Permalink

Hi Dana,

Thank you for the posting. When I asked for details after your comment it was not clear you had filed the TW-39588 issue before. This original issue would be a good place to discuss, but since this thread is opened, let's discuss here.

The way to "propagate" brnach from one build configugraiton to another is to use TeamCity snapshot dependencies. If you have snapshot dependency from B to A, finish build trigger in B would force the same branch in B which corresponding build of A is tagged with.

However, when using snapshot dependencies, finish build trigger should be used only rarely, with the dependencies in place you should generally trigger the build you want to get in the end, as the result of the entire build chain. This is usually something like "create distribution" or "deploy to test environment". Triggering the build would put the entire build chain into the queue and then only the necessary builds will be re-builded.

There is important limitation, though, snapshot dependnecies propagate a single branch through the entire chain (all the build in the chain are triggeried with the same logical/TeamCity branch). This is why I have mentioned the feaure request TW-25586 in the comemnts earlier.

Maven trigger does not play niely with TeamCity snapshot dependencies (at least when there can be several build chains started at the same time), and Mavn trigger is quite limited and basic tool, I'd not base any serious setups on it.

All in all, TeamCity feature branches functionality is targeted mainly at _feature_ branching, that are branches which are created and deleted on a daily basis, without any special additional configuraiton.
If your brnaches are different (e.g. release branches), it is recommended to use different build configurations or entire projects in TeamCity to work with each release branch. To reuse settings between build configurations you can use templates.


Please sign in to leave a comment.