Skip to main content

Bazel Training

These training courses are instructed by Alex Eagle, Aspect's co-founder and Bazel community expert.

To sign up for a live training, see https://www.aspect.dev/services#training.

At each step, you'll try some exercises to get a hands-on experience. You can pick whether you're most comfortable in Java, Python, Go, Swift, or JavaScript.

Paid Content

Our training courses are available for Aspect Pro and Enterprise customers.

If you don't have a login, you can register for Aspect Pro. Email hello@aspect.dev to learn more.

Bazel 101 for Product Engineers

This three-hour training course is intended for product engineers.

You care about developing product features on-schedule. The build system is a necessary evil, which you rely on for quick iteration time.

Our Bazel 101 training course provides the missing Bazel foundation for product engineers to keep their build and test loops fast, without getting bogged down in Build Systems details.

Course Syllabus

  1. Intro
  • What is Bazel
  • Essential properties and mental model.
  • Rationale for choosing Bazel for a project.
  • Installing the bazel CLI, optionally also aspect CLI
  1. Introduction to the Codelab.
  • Walkthrough of the languages used.
  • Demo videos of the various services running.
  1. Bazel Workspace
  • Concept of Workspace
  • Command-line flags and rc files
  • Bazel info keys
  1. The phases of Bazel's evaluation model
  • Discussion of each phase: configure, fetch, load, analyse, execution.
  • Typical commands to trigger each phase in Bazel.
  1. Configuring Bazel via BUILD files
  • Concepts: Package and Label.
  • Writing BUILD files for several languages.
  • Finding existing rules.
  • Using run_binary to adapt a runnable tool to a build step.
  • Dealing with tools that don't seem to work with Bazel.
  • Rules vs. Macros
  1. Using simple Macros to compose rules.
  • What is a macro, intro to syntax.
  • Several example macros.
  1. Testing
  • Common flags to bazel test.
  • Common tags to influence test behavior.
  • Intro to the Test Encyclopedia.
  • Test outputs.
  • Testing services.
  • Flakiness.

Aspect customers: access the training materials at https://pro.aspect.build/category/101-product-engineers

Bazel 201 for DevInfra Engineers

This three-hour training course is intended for "Developer Infrastructure" or "Engineering Productivity" Engineers.

Unlike product engineers, your job responsibility requires a deep knowledge of how Bazel works, how you can configure it to maximize your developers productivity and avoid common "foot-guns".

You may want to take the 101 course prior to 201, as the knowledge from it is assumed here as a pre-requisite.

Course Syllabus

  1. How to approach a Bazel Migration.
  • Incubate "Net Promoters".
  • Keep workflows intact.
  • Change one thing at a time.
  • Ratchet mechanism and Gradient Ascent.
  • Close the loop
  • Leave the code alone, leave few fingerprints.
  • Technique for patching rather than forking.
  1. Codelab revisited, for setting up Bazel from scratch.
  2. Deep dive into how Bazel manages dependencies.
  • Concepts of fetching.
  • How Bazel interacts with Package Managers.
  • Pinning third-party dependencies.
  • Configuring the downloader and avoiding "eager fetches".
  1. Deep dive into the Dependency graph and Action graph.
  • BUILD file generation.
  • Using buildozer.
  • bazel query and the Dependency graph.
  • bazel aquery and how rule implementations lower the Dependency graph to the Action graph.
  1. Performant builds.
  • Details about caches, and spawn strategies.
  • Checking in generated code.
  • Watch mode.
  • Profiling builds.
  1. Writing custom rules.
  • Why to use Macros instead.
  • Intro to the rules-template.
  • Common patterns for writing a rule.
  1. Running Bazel on a CI/CD platform.
  • Shared Green.
  • Versioning.
  • Stamping.
  • Selective Delivery.
  1. Monitoring and Operating a Bazel repo.
  • Philosophy of a DevInfra team.
  • Keeping cache hit rates high.
  • Tuning actions with execution requirements.
  • Preventing "weeds".

Aspect customers: access the training materials at https://pro.aspect.build/category/201-devinfra-engineers