How should we configure our 7.1 install to build all Git branches, but only deploy from the develop branch?

We have what seems to be a pretty typical setup with the folowing git repo branches:
- master
- develop
- release-x
- release-y
- feature-i
- feature-j

we want to use the new feature branches feature (http://blogs.jetbrains.com/teamcity/2012/08/07/teamcity-7-1-control-the-flow/) to build all branches on every push to any branch.  It'll run unit tests on these branches also.
we also want to deploy the compiled code *only from the develop branch* to our development servers on every push.

We've accomplished this by creating two build configurations:
*Development Branch Builds
- build all branches and run tests
- default branch: develop (not ideal, we don't even want to build this branch in this project)
- Branch Specification:
-:refs/heads/development
-:Release-*
-:refs/heads/Release-*
-:development
-:master
-:refs/heads/master
+:refs/heads/*

*Development Deployment Builds
- builds development branch, runs test, and deploys to test server
- default branch: development
- no Branch specification

The problem is that every time we push something to the development branch, both builds run - despite the -:development and -:refs/heads/development.  It ties up two of our three build agents for 15 mins.  The "Development Branch Builds" build is redundant because the Development Deployment Builds build does all of the same work plus deployment.

Is there a way to configure these two builds so the development branch changes are ignored in the "Development Branch Builds" project?
Is there a better project configuration to use to accomplish the same end result?

Thanks.

2 comments
Comment actions Permalink

I would very much like to know this as well. I created a similar post on StackOverflow, but didn't get an acceptable answer.

0
Comment actions Permalink

Hi Gudjon,

The recommned approach is to split build configuration into to separate build configurations, as suggested in this comment. It is not recommended to change the logic of build inside build script. In this case it will be difficult to interpret the results of the build and also the statistics of the builds will be uninformative.
As workaround you can create additional build step between "Run tests" and "Build and Deploy" to check the branch, for example something like this:
if [ %teamcity.build.branch.is_default% = "dev" ]; then
     exit(0)
fi
Please watch and vote for the related feature request https://youtrack.jetbrains.com/issue/TW-17939.

0

Please sign in to leave a comment.