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
macos_instance. Already things like Docker Builder and
are basically a syntactic sugar for launching Compute Engine instances from a particular limited set of images.
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 # optional. Defaults to 2 CPUs. memory: 16G # optional. Defaults to 4G. disk: 100 # optional. By default uses the smallest disk size required by the image. nested_virtualization: true # optional. Whether to enable Intel VT-x. Defaults to false.
Nested Virtualization License
Make sure that your source image already has a necessary license. Otherwise, nested virtualization won't work.
Building custom image for Compute Engine¶
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'