Skip to content

Update teamcity docs with info about fetchallheads #1840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/build-server-support/build-server/teamcity.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ TeamCity has support for meta-runners which allow custom tasks. There is a GitVe
- [Project Link](https://github.com/JetBrains/meta-runner-power-pack/tree/master/gitversion)

## Running inside TeamCity
When running in TeamCIty you have two options, run using **agent checkout** or use dynamic repositories.
When running in TeamCity you have two options, run using **agent checkout** or use dynamic repositories.

### Agent checkout
For GitVersion to pick up pull requests properly you need to promote the `%teamcity.build.vcs.branch.{configurationid}%` variable to an environment variable called `Git_Branch`

Just go to your build configuration, Parameters, click Add, Name should be `env.Git_Branch`, value should be `%teamcity.build.vcs.branch.{vcsid}%` where vcsid is your VCS root id. You should get auto completion for this.

For GitVersion to work with any mode requiring other than the currently built branch to calculate the version number, you need to set the configuration parameter [`teamcity.git.fetchAllHeads = true` in TeamCity](https://www.jetbrains.com/help/teamcity/git.html#Git-GeneralSettings), because TeamCity by default fetches only the current branch for building.

To add this configuration parameter to your build configuration, go to *Parameters*, click *Add*, *Name* should be `teamcity.git.fetchAllHeads` and the value should be `true`.

### Dynamic repositories
To use server side checkout, you must use the dynamic repositories feature of GitVersion. Server side checkout sends just the files to the agent and not the actual .git folder. Dynamic repositories will clone your repo into a temp folder and use it to calculate version information.

Expand Down