On the builds server I have set up TeamCity (8.1.1) so that it executes the build process if there are changes in either the master, one of the feature branches or one of the pull request branches using the branch specifier:
+:refs/heads/*
+:refs/pull/(*/merge)
I have turned on the build agent option:
teamcity.git.use.local.mirrors=true
which clones the repository in a directory outside the build directory and then pulls from that local repository.
The build process needs access to the git repository and the master branch, even for builds of one of the feature branches or pull request branches. However TeamCity only has the branch that contains the changes in the local repository thereby making my builds fail, e.g. when the change was on the issue/mycoolissue branch then that is the only branch that exists in the git repository in the TeamCity working space.
I have tried performing a local git fetch
to get the master branch but because the local repository does not have the master branch this fails. While I could add a remote pointing to the origin (a github private repository) that would mean that I'd have to handle credentials as well and I'd rather have TeamCity take care of all of that for me.
My question is whether there is a way to tell TeamCity to just pull all the branches into both the local repository and the working repository?
git pull fetches updates for all local branches, which track remote branches, and then merges the current branch.
Starting from TeamCity 10.0.4, you can do that by adding a configuration parameter teamcity.git.fetchAllHeads=true
See here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With