20

Working with github and teamcity, builds seem to either be refs/heads/master or master branch.

Whenever the github service hook launches a build, it is on the branch master.

Whenever TeamCity launches a build (e.g. when I start a build, or a dependency building triggers a build) the branch is refs/heads/master.

This causes two build numbers to be shown on the same page, the last build for master and the last build for refs/heads/master.

Is there a way to make TeamCity triggered builds build master instead of refs/heads/master?

Or is there a way to get master and refs/heads/master to be treated as the same branch, not as different ones?

daboross
  • 608
  • 9
  • 22
  • 1
    would "Branch label on a build" mentioned in http://confluence.jetbrains.com/display/TCD7/What's+New+in+TeamCity+7.1 help in any way? – VonC Dec 09 '13 at 07:39
  • I looked at that, and tried adding `+:refs/heads/(master)` to the branch specification. Unfortunately that just made it show two 'master' branches, instead of combining them. – daboross Dec 10 '13 at 01:09
  • I think that may have actually worked, I had to do a few other things as well, and delete all old builds, but that helped @VonC – daboross Dec 10 '13 at 01:34

1 Answers1

22

I think I found a solution to this, though it isn't ideal because I had to delete all passed builds.

I had to first copy the projects and delete the old ones to get rid of all builds that had been run.

Then I configured the default branch to be master. And I set the other branch specifications to:

+:(master)
+:refs/heads/(master)

Also, I updated the VSC trigger to listen on +:master instead of +:*.

Then I tested by manually triggering a build, and having github test hook trigger a build. It seem to have worked, they are both grouped under master!

Fuzzy Purple Monkey
  • 1,920
  • 3
  • 15
  • 23
daboross
  • 608
  • 9
  • 22
  • 6
    It worked fine without `+:(master)`. I set default branch to `master` and added `+:refs/heads/(master)` to other branch specification. (TeamCity 8.1.5) – Domas Oct 10 '14 at 09:39
  • 2
    This answer was really helpful. I'd like to add that you can add format like so: `+:refs/heads/(release/*) ` this way in TC you see `release/1.0` – Matt Canty Aug 31 '16 at 10:07
  • 3
    The explanation from JetBrains for why this is necessary is here: https://youtrack.jetbrains.com/issue/TW-51478 -- I feel like this deserves some more explicit documentation though... – Raman Nov 21 '17 at 18:27