BuildBuddy Cloud has experimental support for running remote build actions within Firecracker microVMs, which are lightweight VMs that are optimized for fast startup time. MicroVMs remove some of the restrictions imposed by the default Docker container-based Linux execution environment. In particular, microVMs can be used to run Docker, which means that actions run on BuildBuddy can spawn Docker containers in order to easily run apps that require lots of system dependencies, such as MySQL server.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/buildbuddy-io/buildbuddy/llms.txt
Use this file to discover all available pages before exploring further.
BUILD configuration
Let’s say we have a BUILD file like this:BUILD
docker_test.sh that looks like this:
docker_test.sh
exec_properties to the test runner action:
BUILD
The
test. prefix on the exec_properties keys ensures that the
properties are only applied to the action that actually runs the test,
and not the actions which are building the test code. See
execution groups for more
info.Preserving microVM state across actions
MicroVM state can be preserved across action runs by enabling therecycle-runner exec property:
BUILD
ubuntu:20.04 image
already cached. This is an optimization, and should not be relied upon for
correctness. Finding a warm VM can fail for various reasons, like because it
fell out of the cache or the machine that has it is fully loaded.
This works across test targets, as long as their platform properties, including
exec_properties are identical. To create separate microVMs, add any unique
execution property. You should do this to separate tests with different
environments, so the VMs do not become too large.exec_properties.
A single microVM snapshot may be used by many test runs, and can survive for
very long. To start a fresh instance, add an execution property or modify an
existing one.
For the above reasons, we recommend using test.runner-recycling-key to encode
dependency and version information. For example, a test that keeps MySQL running
between runs should have "test.runner-recycling-key": "mysql@v1.2.3". When you
switch to a new version of MySQL, you would update this to guarantee a new
microVM.
Using custom images
If you are using a custom RBE image, you do not need to do anything special to make it work with Firecracker. BuildBuddy will automatically convert your Docker image to a disk image compatible with Firecracker. Thecontainer-image execution property is specified using the same docker://
prefix, like: docker://some-registry.io/foo/bar.
To run Docker containers in your microVM (Docker-in-Firecracker), you will
need to make sure your container image has Docker installed. BuildBuddy’s
default RBE image already has Docker installed, but when using a custom
image, you may need to install Docker yourself.
See Install Docker Engine for
the commands that you’ll need to add to your Dockerfile in order to
install Docker.
Test Docker installation
Once you’ve built your custom image, test that Docker is properly installed by running: