Implementing GitFlow within TeamCity

Hello,

I have recently started using GitFlow, and I am trying to setup the various Build Configurations that I think are required to make it work.

I my eyes, there should be at least 3 build configurations.

The first would have a branch spefication like the following in the VCS Root:

+:refs/heads/feature/*
+:refs/heads/hotfix/*
+:refs/heads/release/*

i.e. targetting only commits to feature, hotfix and release branches.  The build steps associated with this build configuration would ensure that each commit compiles correctly, but might not do more rigorous unit/integration tests.

The second would have a branch specification like the following in the VCS Root:

+:refs/pull-requests/*/merge

i.e. only interested in when a Pull Request is initiated from a working feature, hotfix or release branch, into either the develop/master branch.  The build steps assocaited with this build configuration would then ensure that not only the code compiles, but that any unit/integration tests, also pass.

The final build configuration would have a branch specification like the following in the VCS Root:

+:refs/heads/(master)
+:refs/heads/(develop)

i.e. only interested in running the build when there are commits into the master and develop branch.

With this setup in place, I am happy to say that I "think" I have a pretty good system in place, and it follows the GitFlow practices quite closely.

There is however, one problem.  When I have a branch specification like this:

2014-10-07_0828.png
Where I am trying to set up the build configuration to ONLY be interested in Pull Requests, I have to put "something" into the default branch, and since the Pull Request branches are short lived, I can't use one of them.  As a result, once a Pull Request is merged into say develop, my third build configuration listed above is kicked off, and I am then left with pending changes in the second build configuration, since there are changes in the develop branch.

I know that these don't mean anything, and can be ignored (or I am manually trigger a build from the develop branch), but I also find it a little jarring.  Is there a way to tell TeamCity to completely ignore any changes in other branches, and only be interested in changes that are releated to entries in the branch specifications?

Or, am I doing something completely wrong, and there is a better way to do what I want?

0
6 comments

It seems that this could be a related issue:

http://devnet.jetbrains.com/thread/457482?tstart=0

Gary

0

Can anyone help with this?

It was suggested that I try to add:

+:*
-:<default>

to the build trigger branch filter, but I was already doing that.

Thanks

Gary

0

Hi,

Sorry for delay. Unfortunately it is not possible to exclude default branch now, please watch/vote for the related issues - https://youtrack.jetbrains.com/issue/TW-23395, https://youtrack.jetbrains.com/issue/TW-24147.

0

Thanks for getting back to me about this, I really appreciate it!

I am now following those issues, so hopefully this will be addressed in a future version of the product.

Gary

0

Hi - has there been any change to this?

0

Hi Rob,

You can now disable default branch build. That gives you the possibility to integrate teamcity with Git Flow easily !

Check the changelog - https://confluence.jetbrains.com/display/TW/Indore+2017.1+EAP2+(build+46288)+Release+Notes#Indore2017.1EAP2(build46288)ReleaseNotes-Modifiedsettingsforchangescalculation

0

Please sign in to leave a comment.