Change a build parameter based on the VCS branch trigger


I have a build configuration in TeamCity with a build parameter called "PublishProfile" that is used to change which publish profiles are used when doing a custom build manually in the TC project interface, the parameter can have 1 of 3 values: "Development", "QA", "Production"

I am then trying to use hg flow with Mercurial

Which uses the below list of branches:
master = default
develop = develop
feature = feature/
release = release/
hotfix = hotfix/
support = support/

and I want to configure a build configuration so that when pushing to the "develop" branch in VCS will trigger the build steps using the appropriate "PublishProfile" build parameter of "Development"
and for "release/*" it uses "QA"
and for "default" it uses "Production"

Is this possible?
Comment actions Permalink

Sorry I don't understand where this is in the User Interface or how it could be triggered depending on the relevant VCS branch, do you have any examples of how this works?


Comment actions Permalink

It's not a user interface. You need to add a new build step, make it the first and add something like this (assuming this is a command line runner):
if [['' == 'master']] ; then
   echo ##teamcity[setParameter name='' value='prod']

if [['' == 'myFeature']] ; then
   echo ##teamcity[setParameter name='' value='QA']

Comment actions Permalink

How would this work for sub-branches like

feature/{feature name here}
release/{release name here}

when using Mercurial?

Comment actions Permalink

The same way as above:

if [['' == feature*]] ; then
   echo ##teamcity[setParameter name='' value='feature']

Please note that contains logical (TC) branch name, not a real branch name:


Please sign in to leave a comment.