We use TeamCity for continuous integration and Git for source control. Generally it works pretty well - convenient, modern and good us quick feedback when tests fails.
There is a strange behavior related to Git merge specifics. Here are steps of the case:
- First developer pulls from master repo.
- Second developer pulls from master repo.
- First developer makes commit A locally.
- Second developer makes commit B locally;
- Second developer pushes commit B.
- First developer want to push commit A but unable because he have to pull commit B first.
- First developer pull's from remote reposity.
- First developer pushes commit A and generated merge branch commit.
The history of commits in master repo is following:
- B second developer
- A first developer
- merge branch first developer.
Now let's assume that Second Developer fixed some failing tests in his commit B.
What TeamCity will do is following:
- Commit B arrives - TeamCity makes build #1 with all tests passed
Commit A arrives - TeamCity makes build #2 (without commit B) test bar becomes Red!
TeamCity thought that Pending "Merge Branch" commit doesn't contain any changes (any new files) - but it actually does contain the merge of commit B, so the TeamCity don't want to make new build here and make tests green.
Here are two problems: 1. In our case we have failed tests returning back in second commit (commit A) 2. TeamCity don't want to make a new build and make tests back green.
Does anybody know how to fix both of this problems.
I consider some reasonable general approach.