I am in-charge of ~40 TeamCity builds across 7 or so projects. Currently, they each have their own Git credentials, which is silly, because they are actually all using the same logon. They are only slightly different from each other, in that
How can I set this up so they all use the same Git logon in team city, such that when this logon expires, I don't have to reset 30-ish passwords?
I understand that there are build parameters, and I can kind of share VCS roots, but these roots only appear to be visible to builds of the same project... and I don't see a way to do this to the "Root" project.
Shared VCS Root
The Root project would be the place to setup a VCS root that is inherited across all projects; and as the same login is used to authenticate with the host repository server you can simply define this at that root level too.
To add a VCS root in the Root project, navigate to:
https://{HostServer}/admin/editProject.html?projectId=_Root&tab=projectVcsRoots
and from there you can click Create VCS root
. Any build configuration in your TeamCity instance will then have access to attach that VCS root. Set the login details when creating that VCS root.
Parameterising the VCS root
they checkout different branches
You can parameterise the Default branch
to enable the VCS root branch to be dynamically configured based on a build parameter, which would need to be provided / overridden at either a sub-project or configuration level. For example:
%system.DefaultBranch%
as a Default branch
value would require any configuration using the VCS root to provide a value for %system.DefaultBranch%
. You can specify a default value for this parameter at the Root project
level to make things easier if you have a lot of configurations using, say, refs/heads/master
.
they use a different base repos (but are on the same server)
Similarly, you can parameterise the Fetch URL
to enable the VCS root to be dynamically configured based on a build parameter, which would need to be provided / overridden at either a sub-project or configuration level. For example:
[email protected]:myname/%system.GitRepositoryName%
as a Fetch URL
would require any configuration using the VCS root to provide a value for %system.GitRepositoryName%
. This can be provided as a Project parameter or a Build Configuration parameter. If you have multiple build configurations that all use the same repository under the same project, then it's probably best to go with the Project parameter approach.
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