1
votes

I am currently trying to implement GitFlow in a GitLab test project and then run the builds from TeamCity.

I have configured my GitVersion.yml file so that when I create a release branch (e.g. release/0.3.0) from develop versioned 0.3.0-alpha.3 for example and then commit to develop, the minor version on develop should increment (e.g. 0.4.0-alpha.1). But when I build develop on TeamCity it gets versioned 0.3.0-alpha.4 instead and I am required to build the release branch first and then rebuild develop to get the correct version 0.4.0-alpha.1.

Is there no way to get GitVersion to calculate the correct version of a develop branch build in TeamCity without having to first build the release branch? I would like to avoid the possibility of a developer building develop and a package with the wrong version gets pushed to the Octopus server.

Software versions:

  • TeamCity: 2017.2.4 (build 51228) & 2018.1 (build 58245)
  • GitVersion: v4.0.0-beta0012
1

1 Answers

2
votes

I have confirmed the problem to be that TeamCity does not fetch all the branches from the repository when creating the working copy. This causes issues with my GitVersion configuration that requires branches to derive their version information from another branch.

The simple solution is to add a configuration parameter in your project called teamcity.git.fetchAllHeads with the value true. This forces TeamCity to fetch all the branches from your repository.