I've got a CI build pulling feature branches from Github and building/packaging them into a local folder, using a folder naming convention based on the project, branch and build number.

For named branches (feature1, feature2) this is working great.

The problem is that when I do a commit to the master, TeamCity exposes teamcity.build.branch as <default> - which means when the build step expands

E:\Packages\MyProject\%teamcity.build.branch%\

it's ending up with E:\Packages\MyProject\<default> - which is then crashing the build step because it isn't a valid Windows path.

I can see the master branch name in the fully-qualified build parameter:

teamcity.build.branch                         <default>
teamcity.build.checkoutDir                    C:\TeamCity\BuildAgents\agent-mulder\work\2151838a7933464d
teamcity.build.default.checkoutDir            2151838a7933464d
teamcity.build.id                             16347
teamcity.build.vcs.branch.github_myproject    refs/heads/master

but ideally I need to get master as the teamcity.build.branch for use in my build steps.

Can I transform the parameter at runtime? Override the behaviour? I've even tried setting the VCS branch name to DO_NOT_USE in the hope that "master" would no longer match the default - but this doesn't appear to work either.

Edit
Report