We just discovered this forum, which maybe can help resolve an issue that we have already posted on StackOverflow. Here is a copy of the question, any help is greatly appreciated.
We have TeamCity configured to trigger a build on each checking. Our source control is Git, and a typical push contains 2 commits, the commit we the changes to apply to the code base and a merge created automatically when pulling the latest code from the master branch before pushing.
TeamCity is setupped with those 2 options checked:
Trigger a build on each check-in
Trigger a build on each check-in Include several check-ins in a build if they are from the same committer
The purpose is to build once for each push. For each push, we expect the latest commit to be built.
However, sometimes the first commit of the push is built instead of the last one, which is not what we wanted nor expected.
Does anyone know how we can force only the last commit to be built an not a random one?
After a little more investigation, we noticed that TeamCity actually expects the commit Id to be sequential to determine the latest one. This conflicts with the commit id used by Git which are SHA-1 and are not sequential. For example, after a push that contained 2 commits:
12eb5e7... => Commit the new feature, local commit before the pull
10e49a4... => Commit the merge resulting of the pull from master
TeamCity triggered a build when the push was made, but it chose the commit 12eb5e7 instead of 10e49a4, probably because 12 is greater than 10. However, in this case, the commit containing the merge is made after the other one and should be the one built.