Bitbucket, path-like branches and pull-requests
We have two branches dev/1.0.1 and dev/2.0, first for 1.0.1 version of product, second for version 2.0
And we make pull-requests for both versions, but I have no idea how to make Build Configuration for two branches. Can you help me?
What I should set in Default Branch field? As I know, dev/* doesn't work and I should set name of branch.
We use Bitbucket.
Please sign in to leave a comment.
Hi Sergey,
for the default branch you are going to want to put the name of the branch in each configuration exactly, just like it is.I'm not all that familiar with bitbucket's internal format for pull requests. It seems like they have something like a refs/pull-requests/* or refs/pull/* format. You need to add that to the branch specification, not default branch, for TeamCity to be able to track them.
With this in mind, TeamCity doesn't have a way to discriminate the different origin of the pull requests just yet, so it's not possible to know directly to which branch each pull request belongs. If bitbucket offers branch names in a way that can automatically reference their original, then you can add that branch format to the branch specification and those should be automatically picked up. Other than that, I'm afraid that the previous statement holds true.
We are working on bringing pull request support, first with github and that will open the door for other services. In the meantime, there might be a way to work around, but will include manual scripting:
-Have two separate build configurations A1 and A2. Each has its own default branch (dev/x) and share the same specification, the pull requests.
-Create a build configuration B that has the VCS Root with any default branch, no reference to dev/1.0.1, dev/2.0, then refs/pull-requests/* as branch specification.
-Add a VCS Trigger to it.
-Create a build step with a script that identifies which one is the branch that this request corresponds to, and then uses the REST API to trigger a build on the appropriate build.
Hope this helps.