Reputation: 4865
I am trying to setup a TeamCity build to only build feature branches, and ignore master, develop, etc.
I current have this in this in my Branch specification:
+:refs/heads/feature/*
Upvotes: 12
Views: 7173
Reputation: 8668
The following setup is working for my pre-release builds on TeamCity 8.0.6.
Branch specification (visible when you select "Show Advanced Settings"):
+:refs/heads/hotfix/(*)
+:refs/heads/release/(*)
Default branch: teamcity-default-dummy
From my understanding you need to specify a default branch other than the branch you want to exclude. I believe it will trigger on commits to the default branch, regardless of branch specification, but I may be wrong.
I had to create a dummy branch and point default here for my pre-release build configuration, because I just got an error it could not get changes from master branch, which does not exist in my repo. You might not need to do this.
Related, I found this article very useful for setting up git with TeamCity. Although this focuses on git-flow the same concepts apply for any branching model.
Update Feb 2015
Still as of TeamCity 9.0 you need to specify a default branch and the default branch will trigger builds. For this case I recommend creating a dummy branch that will never be committed to, such as in the example above.
Help upvote on: https://youtrack.jetbrains.com/issue/TW-24147
Upvotes: 13
Reputation: 1293
At this time this is not possible. You have to define a default branch. TeamCity takes it into account when it calculates changes in the build in the feature branch and in many other places. As a workaround you can modify your build script to do something different when it is run on a default branch.
Upvotes: 3