TeamCity VMware vSphere plugin
TeamCity always aims at giving your team more build power, and for those of you taking advantage of local cloud capabilities with VMware vSphere, the new TeamCity VMware vSphere plugin will surely be an asset. With this plugin, TeamCity can start and stop TeamCity agents installed on VMware virtual machines on demand, similarly to integrations with Amazon EC2 and Azure .
TeamCity-VMware cloud agent integration requires:
- the TeamCity VMware vSphere Cloud plugin (compatible with TeamCity 8.1+) installed on the TeamCity server;
- a configured virtual machine with an installed TeamCity agent in your cloud set up to start the TeamCity agent on boot,
- a configured cloud profile on the TeamCity server.
Let’s go step-by-step and set up the integration.
Install the plugin and configure the virtual machine
Since the plugin is not bundled with TeamCity, we need to install it on the TeamCity server. Next we need to create a virtual machine where our builds will run.
The virtual machine with the TeamCity agent needs to be prepared as described in our documentation; when configuring the TeamCity build agent, be sure to specify the valid TeamCity server URL in the build agent properties.
After you start the build agent, it connects to the server, and you need to authorize it in the TeamCity Web UI so that the builds can run on the agent. Please ensure that the agent that connected to the server can actually run the builds you want it to run later.
When configuration and testing is complete, power off the virtual machine. If we want TeamCity to clone this virtual machine for us, we need to create a snapshot of this virtual machine.
You can also use the machine you created to make a template, see more information in the VMware vSphere documentation.
Configure the TeamCity VMware profile
Next we need to create an agent cloud profile in TeamCity on the Administration | Agent Cloud page selecting VMware vSphere as the cloud type.
A profile name is required; it is also recommended to configure the Terminate Instance Idle Time setting which will save you the resources: it specifies the period of time for the virtual machine to run without builds after which TeamCity will stop it. You also need to provide the cloud access information, including the vCenter SDK URL and your user credentials.
You can verify your credentials using the Test connection / Fetch options button, which also refreshes the information on the virtual machines, snapshots and resources available in your cloud.
Now we can add images and specify the virtual machines or templates we want TeamCity to use.
The VMware vSphere plugin can either start and stop an existing virtual machine, or clone virtual machines from snapshots deleting the clone after the machine is stopped. For templates only the clone behavior is supported.
Click Add Images and select the virtual machine and the desired behavior. For the clone behavior, select the snapshot to use, the folder for clones and the resource pool where your machine will be allocated. The maximum number of instances will limit the clones created.
In this test set up we are using the clone behavior with 2 being the maximum number of instances: TeamCity will clone a machine from the specified snapshot and will delete the cloned machine after it is stopped:
When the images are added and the profile is saved, a clone is created from the snapshot. It connects to TeamCity and TeamCity processes build configurations-to-agents compatibility.
As with all cloud integrations, you can view and manually start/stop the cloud agents on the dedicated Agents| Cloud page in the Teamcity Web UI:
Our integration is configured. Now when distributing queued builds, TeamCity will start a compatible agent in vSphere if required.
The agent will be authorized automatically and will start running builds. The Agents page will display the builds running on the cloned machines:
Try the plugin and don’t hesitate to share your feedback with us!