Skip to content

Custom Compute Engine VMs

Cirrus CI supports many different compute services when you bring your own infrastructure, but internally at Cirrus Labs we use Google Cloud Platform for running all managed by us instances except macos_instance. Already things like Docker Builder and freebsd_instance are basically a syntactic sugar for launching Compute Engine instances from a particular limited set of images.

With compute_engine_instance it is possible to use any publicly available image for running your Cirrus tasks in. Such instances are particularly useful when you can't use Docker containers, for example, when you need to test things against newer versions of Linux kernel then the Docker host has.

Here is an example of using a compute_engine_instance to run a VM with KVM available:

compute_engine_instance:
  image_project: cirrus-images # GCP project
  image: family/docker-kvm # family or simply a full image name.
  platform: linux
  cpu: 4
  memory: 16G
  nested_virtualization: true # Whether to enable Intel VT-x. Defaults to false. 

Building custom image for Compute Engine

We recommend to use Packer for building your custom images. As an example, please take a look at our Packer templates used for building Docker Builder VM image.

After building your image, please make sure the image publicly available:

gcloud compute images add-iam-policy-binding $IMAGE_NAME \
    --member='allAuthenticatedUsers' \
    --role='roles/compute.imageUser'