Provision fresh VM before every build

I want to extend the build process of TeamCity so that a new virtual machine will be provisioned before the build starts and destroyed afterwards. The final process might look like this:

1. New build is triggered.
2. Provision new virtual machine using provisioning information either supplied in the build configuration or in the source repository (Provisioning information is at least project specific).
3. Install build agent on the virtual machine.
4. Let the build agent and TeamCity do their work.
5. Unregister build agent.
6. Destroy virtual machine.

I thought I might be able to pull it off using the Cloud API because the current EC2 and VMware plugins work similar. Unfortunately not similar enough:

* I'm unable to access the build configuration or the source repository from the Cloud API.
* It seems to be required to launch the VM up front so that the build agent can be queried before the build is assigned to it. But without a running build there's no VM with a build agent... (The VMs aren't necessarily similar, one might run Windows, another MacOS X with vastly different capabilities, in other words: pre-load the build agent to a VM template does not seem to be doable)

Did I miss something? Is there some other suitable approach? Or are there any changes scheduled for the upcoming version 9.0 that might make it possible? As far as I see the current EAP does not contain any changes in the Cloud API.

Please sign in to leave a comment.