TeamCity integration with Google Compute Engine which allows using cloud instances to scale the pool of build agents.
The plugin is compatible with TeamCity 10.0.x and greater.
You can download the plugin and install it as an additional TeamCity plugin.
For configuration details please take a look at the TeamCity Google Cloud plugins blog post.
The plugin supports Google Compute images to start new instances. You also need to create a new JSON private key and assign the Compute Engine Instance Admin (v1)
and Project Viewer
roles or create your own with a following permissions:
compute.images.list
compute.instances.create
compute.instances.list
compute.instances.setMetadata
compute.machineTypes.list
compute.diskTypes.list
compute.networks.list
compute.subnetworks.list
compute.zones.list
Note: If you're using "Instance template" image type also assign a Service Account User
role.
To verify whether your service account has all required permissions please enable Google Cloud Resource Manager API in your project.
Before you can start using the integration, you need to create a new cloud image. To do that, create a new cloud instance, install the TeamCity Build Agent on it and set it to start automatically. You also need to manually point the agent to the existing TeamCity server with the Google Cloud plugin installed to let the build agent download the plugins.
Then you need to remove temporary files and create a new image from the instance disk.
To specify instance metadata you could the "Custom metadata" property in cloud image settings. It could be useful while defining startup and shutdown scripts.
If you are using preemtible instances you have to specify shutdown script to gracefully reschedule build from preemted VM on another build agent like that.
For Linix instances:
{
"shutdown-script": "#! /bin/bash\n/opt/buildagent/bin/agent.sh stop force"
}
For Windows instances:
{
"windows-shutdown-script-cmd": "C:\\BuildAgent\\bin\\agent.bat stop force"
}
Apache 2.0
Please feel free to post feedback in the repository issues.