Multiple Agents / Multiple TeamCity Server Setup

I belong to 2 TeamCity Servers, for 2 differing organizations. I would like to have the same server be a build agent for both instances.

1) Can I connect an Agent to 2 different Servers in order to restrict it's build process to one at a time?

2) If not, how can I have 2 Agents on the same PC utilize SharedResources to prevent them both building at the same time?

3 comments
Comment actions Permalink

Hi,

You could have a build agent connect to two different TeamCity servers, but the tricky part is that each server will be expecting a different Authorization Token and TeamCity URL. So, I suppose you could have two different buildAgent.properties files, one for each TeamCity server, and just swap in the one you need when you need it.

Another approach would be to just install a second agent on the same machine and start the one you need when you need it. Personally, I feel like this would be easier to manage and less hassle. We have documentation on installing multiple agents on the same machine here: https://www.jetbrains.com/help/teamcity/install-multiple-agents-on-one-machine.html.

0
Comment actions Permalink

Installing multiple agents was my 2nd method too, but how can the 'SharedResources' feature be handled at a server level instead of an agent level?

i.e. Agent 1 on Machine 1 runs a huge compilation, taking up 6 hours and almost the entire IO capacity of a server. Agent 2 on Machine 1 should not run it's jobs unless Agent 1 has finished.

Right now the only way I can see this working is to have a bash/powershell script call the TeamCity API for Instance 1 (Agent 1's instance), to see if the agent on the same machine is busy or not and wait if it's busy. This seems overcomplex and makes Build Steps extremely messy.

0
Comment actions Permalink

There is a way to set up shared resources on the TeamCity server, however, it is not possible to manage these resources across separate TeamCity installations. See https://www.jetbrains.com/help/teamcity/shared-resources.html.

Maybe there is some third-party resource management software that could help here, but I'm not sure about it. 

0

Please sign in to leave a comment.