Bazel CI Playbook
Documents step-by-step workflows for deploying CI worker images, Docker images, and Bazelisk versions on Bazel's BuildKite infrastructure.
What this file does
Documents step-by-step workflows for deploying CI worker images, Docker images, and Bazelisk versions on Bazel's BuildKite infrastructure.
When to use it
- You manage CI worker images on GCE and need to update them
- You deploy new Docker images for Linux CI workers
- You release a new Bazelisk version across platforms
- You need to revert a CI worker image to a previous version
Assumes this stack
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-testingorg 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.
cdinto thecontinuous-integration/buildkite/dockerdirectory.- 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
What's inside
3 major workflows with numbered steps, 2 automated scripts, 1 configuration file reference
Change this for your project
- Replace
bazel-trustedwith your BuildKite org name - Replace
gcr.io/bazel-publicwith your container registry - Replace
https://github.com/bazelbuild/continuous-integrationwith your repo URL
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Automating image creation and deployment as separate pipeline steps to avoid interrupting running builds
- Using a testing org to validate new images before pushing to production
Related Documents
Video/Content Producer
Defines a video/content producer role with script structures, hook formulas, storyboard templates, and platform-specific formats for short-form and long-form video production.
Media Handling Playbook - Zyeuté v3
Documents upload, storage, optimization, delivery, and edge-case handling for images, videos, and audio in a social app.
Visual Truth Engine: Product-Market Fit & Go-to-Market Strategy
Outlines a product-market fit strategy and go-to-market plan for a B2B SaaS tool that automates proof asset creation for video creators.
Devin Triage Playbook
Defines a 7-phase automated triage playbook for Devin to analyze alerts, find root causes, implement fixes, and notify teams.