Using Bazel on Buildkite

Bazel is an open-source build and test tool similar to Make, Maven, and Gradle. Bazel supports large codebases across multiple repositories, and large numbers of users.

Using Bazel on Buildkite

  1. Install Bazel on one or more Buildkite Agents.
  2. Add an empty WORKSPACE file to your project to mark it as a Bazel workspace.
  3. Add a BUILD file to your project to tell Bazel how to build it.
  4. Add the Bazel build target(s) to your Buildkite Pipeline.

Buildkite Bazel example

The Building with Bazel example pipeline template demonstrates how a continuous integration pipeline might run on a Bazel project. The visualization below shows the steps in its example pipeline.

Buildkite C++ Bazel example

We've made a short Bazel example which you can run and customize.

Make sure you're signed into your Buildkite account and have access to a Buildkite Agent running Bazel, then click through to the example:

📝 Buildkite Bazel Example A Buildkite Bazel Example you can run and customize. github.com/buildkite/bazel-example

Further reading

  • The Bazel C++ tutorial goes into more detail about how to configure more complex Bazel builds, covering multiple build targets and multiple packages.
  • The Bazel external dependencies docs show you how to build other local and remote repositories.