11
votes

Given there are master and dev git branches, a git repository is hosted on the Github and TeamCity 9.0.1 installed as a CI server.

The teamcity build project is configured to use github repository as a VCS root with refs/heads/master set as a default branch.

The desired behavior is to run auto-merge from master to dev when the build is successful.

So I add an Automatic merge build feature as specified here with the following settings:

  • Watch builds in branches => Branch filter: +:master
  • Merge into branch: dev
  • Merge commit message: TEAMCITY: Automatic merge branch master into dev
  • Perform merge if: build is successful
  • Merge policy: use fast-forward merge if possible

After pressing Run - the build is green, no errors are shown in the Build Log, but totally nothing was merged as desired!

What's wrong and where can I find the debug information about build features execution?

2

2 Answers

4
votes

The thing I really needed was to create a dedicated teamcity project (called Integration) which first handles commits in both master and dev branches. It was achieved by configuring a VCS Root for Integration project with refs/heads/dev specified as a default branch and +:refs/heads/master specified in a branches specification section.

The project has an automatic merge build feature configured with settings similar to specified in the question (branch filter: +:refs/heads/master, merge into branch <default>).

That is the way I solved it.

-2
votes

You need to write a script to push the changes to the GitHub repository. I'm not aware of a plugin existing for this, but I certainly wouldn't be surprised if you find one.

The merge take place on the repository that is on the build server, then if there are no conflicts it is committed using the specified commit message. This needs to be synchronised with your GitHub repository.