Bazel CI Playbook
Status: Work in progress
This guide describes several maintenance workflows that have to be executed frequently.
Deploying new CI worker images
Our Linux and Windows CI workers run on GCE instances. The basic update process consists of the following two steps and has been automated in the bazel-trusted BuildKite org:
- Run create_images to create new VM images. This step starts a temporary VM, configures it as a CI worker, and then saves its image in GCE before destroying the temporary VM. This step does not affect running builds.
- Run create_instances to deploy instances with the new VM images. This step deletes the existing instances, then reads the configuration file to determine how many instances are needed, and finally creates new instances with the new images. As a result, any running builds will be interrupted.
Note: Many changes to the Linux workers don't require these two steps since we run Docker containers on Linux. See below for a description on how to create and deploy new Docker images.
For macOS, follow the internal playbook (go/bazel-ci-playbook).
Windows & Linux
You will need to be a member of the bazel-trusted
BuildKite org.
- Submit your change to this repository.
- Initiate a build on the Create Windows VM image or Create Linux VM image pipeline.
- Wait for the first build step to finish. This will create a new testing Windows VM image.
- Deploy the new image to the
bazel-testing
org by unblocking the next step. - Initiate a new build on the Bazel pipeline in the testing org to test the new image.
- Push the image to prod (bazel and bazel-trusted BuildKite orgs) by unblocking the next step.
- Wait for the VMs to be recreated in the bazel and bazel-trusted orgs and the new image to be deployed.
Note: if anything goes wrong in the new image, you can always revert to the previous image by deleting the new image in the GCP console and re-create the VMs.
Deploy new Docker images for Linux
Most changes can be rolled out by creating and deploying new Docker images. This step requires that
- You are on a Linux machine (images built on macOS may cause problem).
- Docker is installed and set up.
- You need permissions to access the container registry in our GCP project.
Follow these steps to build and deploy a new Docker image:
- Clear your local Docker cache via
docker builder prune -a -f
. - Clone the continuous-integration repository.
cd
into the continuous-integration/buildkite/docker
directory.- Run
build.sh
. - Run
push.sh
.
If you are on the testing
branch, the new image will be pushed to the gcr.io/bazel-public/testing
repository. If you are on the master
branch, the new image will be pushed to the gcr.io/bazel-public
repository.
Deploying a new Bazelisk version
- Create a new Bazelisk release. This step has to be done on a Mac machine (due to cross-compilation problems), and requires permissions to create a release.
- To deploy this release on MacOS:
- Update the Bazelisk Homebrew formula.
- Update the startup script for macOS VMs to install the latest Bazelisk version.
- To deploy this release on Linux:
- Update the Dockerfile.
- Follow the above instructions to deploy new Docker images.
- To deploy this release on Windows:
- Create and deploy new VM images by following the above instructions. There is no need to update any files manually since the setup script always fetches the latest version of Bazelisk