Reputation: 13985
TeamCity supports creating VMs in the cloud for running builds. It can also terminate instance after it is idle for defined period of time.
Is it possible not to terminate but shutdown the instance and to start it again when needed?
Upvotes: 0
Views: 235
Reputation: 4232
If your BA is a VM on Azure then I was able to achieve this by using Azure Automation account (There is a free version).
Basically, you trigger WebHooks for 2 runbooks you import from the gallery - StartAzureV2VM & StopAzureV2VM. The gallery can be found in "Automation Account-> Runbooks -> Browse Gallery"
Then on your TeamCity server you just periodically run some powershell which monitors the build queue on Teamcity and trigger appropriate webhook (with some timeouts etc.).
Here is the script I'm using, feel free to amend it to your needs:
https://gist.github.com/milanio/b300f23883afa9c6288f9365dfb98252
Upvotes: 1