Bazel CI offers a pipeline to test Bazel built at a given commit with a list of configured downstream projects. The pipeline can be viewed at https://buildkite.com/bazel/bazel-at-head-plus-downstream, it is scheduled to run nightly and also be triggered manually. The pipeline enables the following benefits:
The downstream project configurations are located in the bazelci.py script.
You can configure with the following fields:
git_repository
: The git repository of this project.http_config
: The Bazel CI configuration file of this project.pipeline_slug
: Each downstream project must have an existing pipeline configuration on Bazel CI, you can find the pipeline slug in the URL of the pipeline in the form of https://buildkite.com/bazel/<pipeline_slug>
.disabled_reason
: The reason to be temporarily disabled from the downstream pipeline. The value is usually a link to the relevant GitHub issue.If a project at HEAD is already broken in its own pipeline (usually tested against the latest Bazel LTS release), it doesn‘t make sense to test the project at HEAD in the downstream pipeline anymore. Therefore, we record a last_green_commit
for each downstream project, which is the latest commit that is green in its own pipeline. In the downstream pipeline, we test the project at last_green_commit
instead of HEAD
. With this approach, we can avoid any breakage that is solely caused by the project’s own changes.
The Bazel team monitors the downstream pipeline status and report issues for breakages. To keep the downstream pipeline green, we depend on timely responses from downstream project maintainers to address breaking breakages at HEAD. Therefore, we have the following policies for downstream projects:
Note that: if you want to skip some builds in the downstream pipeline, you can specify skip_in_bazel_downstream_pipeline: <reason>
for a given job in your Bazel CI configuration file or add no_bazel_downstream
tag for certain build and test targets.
As of May 2023, some projects' pipeline config files live under the “pipeline” directory of this repository, which means the Bazel team is responsible for their setup for now, ideally they should be moved to their corresponding repository or the project should be removed.
To initiate a build for your local change, you'll need “Build & Read” access to https://buildkite.com/bazel/bazel-at-head-plus-downstream. If you are a core Bazel contributor, you can request the access by filing an issue against https://github.com/bazelbuild/continuous-integration, otherwise please reach out to someone who can have access to initate the downstream testing for your PR (e.g. @meteorcloudy, @fweikert, or @Wyverald).
There is a daily scheduled build on this pipeline with the latest HEAD of the master Bazel branch, but frequently it can be useful to run these tests with your own changes before merging a pull request.
In order to run this pipeline, your changes need to be available on the main Bazel repo as a branch or a PR. Most core Bazel contributors can create branches here. However, it is recommended that you create and upload a change to a personal fork and submit a Pull Request to Bazel.
After the new branch or Pull Request is created, visit the Bazel (with downstream projects) pipeline. Then follow these steps:
HEAD
pull/<pr-number>/head
(e.g. pull/10007/head
for https://github.com/bazelbuild/bazel/pull/10007). If you're using a named branch, enter that name instead. Ignore the drop-down, you can type directly into the text field.The tests will take time to run, so please be patient. Once they finish, be sure to compare the results against the most recent run named “Scheduled build” under the master branch on the main Bazel (with downstream projects) page. The Green Team tries to keep these tests passing, but sometimes there are regressions that aren‘t fixed yet, and it’s unfortunate to try and debug a failure that turns out not to be caused by your changes.
Once you've finished the tests, be sure to check whether you created a named branch and go back to the list of Bazel branches to delete your branch. This makes it easier to run your downstream tests next time!
Bazel downstream projects is red? Use culprit finder to find out which bazel commit broke it!
First you should check if the project is green with the latest Bazel release. If not, probably it's their commits that broke the CI.
If a project is green with release Bazel but red with Bazel nightly, it means some Bazel commit broke it, then culprit finder can help!
Create “New Build” in the Culprit Finder project with the following environment variable:
,
. You can set this to bisect for multiple tasks in one build. It will be ignored if TASK_NAME is set.true
to run bazel clean --expunge
before each build, this will help reduce flakiness)eg.
PROJECT_NAME=rules_go PLATFORM_NAME=ubuntu2004 GOOD_BAZEL_COMMIT=b6ea3b6caa7f379778e74da33d1bd0ff6477f963 BAD_BAZEL_COMMIT=91eb3d207714af0ab1e5812252a0f10f40d6e4a8
Note: Bazel commit can only be set to commits after 63453bdbc6b05bd201375ee9e25b35010ae88aab, Culprit Finder needs to download Bazel at specific commit, but there is no prebuilt Bazel binaries before this commit.
Bazel Auto Sheriff is the pipeline to monitor Bazel CI build status and identify reasons for breakages.
Based on a project's build result in main build (with Bazel@Release) and downstream build (with Bazel@HEAD), the Bazel Auto Sheriff does analyzing by the following principles:
Main Build: PASSED, Downstream build: PASSED
Everything is fine.
Main Build: FAILED, Downstream build: PASSED
Retry the failed jobs to check if they are flaky
Main Build: PASSED, Downstream build: FAILED
Retry the failed downstream jobs to check if they are flaky
Main Build: FAILED, Downstream build: FAILED
Rebuild the project at last green commit
After the analysis, the pipeline will give a summary of four kinds of breakages:
You can check the analysis log for more details.
Bazelisk + Incompatible flags pipeline runs bazelisk --migrate
on all downstream projects and reports a summary of all incompatible flags and migrations statuses of downstream projects.
This pipeline works in the following ways:
Bazel@last_green
by default. But you can override the Bazel version by setting the USE_BAZEL_VERSION
environment variable (e.g. USE_BAZEL_VERSION=5.3.0
).incompatible-change
and migration-ready
labels. You can override the list of incompatible flags by setting the INCOMPATIBLE_FLAGS
environment variable (e.g. INCOMPATIBLE_FLAGS=--foo,--bar
).This pipeline shows the following information: