I've set up TeamCity server + agent running on two separate VMs (I'm using Vagrant+Chef). This works as expected, in that the server is installed to one VM and gets mapped to a local IP, and the agent VM then pulls down the agent zip file and configures itself from there. This is a disposable Vagrant setup for testing new plugins (and possibly developing our own plugins) so I want to automate as much of the setup as possible. But the agent appears as "unauthorized", and I need to use the web interface to manually click the "authorize" button to allow it to take part of the fun. I don't think developers should have to click that button every time they set up a local development environment though, so I went looking for a way to do it via code.
But.. what I've come up with seems rather invasive, so I'm asking here for feedback and thoughts to look for a better way of going about this.
Here's my solution:
I directly alter the DB, by issuing the command UPDATE agent SET authorized=1; which flips the authorized column to True. I then restart the TeamCity server service, and as far as I can tell the agent is now authorized.
But is that really how we do it? Messing directly with an application's DB sure feels dirty!
I originally wanted to go through the REST API, but from googling I understand it's not exposed functionality? I also looked into mimicking the webinterface's HTTP request but couldn't figure out how to phrase that request. I'm new to TeamCity so I might be missing something easier, despite trying my best to google for answers.
What kind of recommendations would you have for bypassing this agent authorization system? Any thoughts, questions, or feedback appreciated.
Thanks in advance,