Skip to content

Recipes useful in using bazel as the main component of a continuous integration build

Notifications You must be signed in to change notification settings

humphrej/bazel-recipes

Repository files navigation

bazel-recipes

This repo is a collection of recipes that I have found useful in using bazel as the main component of a continuous integration build.

Taking on the ideas from the Continuous Delivery book, a “commit stage” pipeline runs before multiple “acceptance test” pipelines. In the commit stage, all artifacts are built - this includes services, and all acceptance tests. The acceptance tests should be baked into containers with all their required dependencies so that running them in the "acceptance test” pipeline is pure scheduling.

Bazel is a great fit for the commit stage pipeline in a cloud-native deployment:

  • it builds containers natively (“rules_docker”)
  • it is polyglot/can build anything (by using/defining the appropriate rule: java, c++, python, golang, docker, dhall, clojure)
  • the pipelne complexity is in the bazel setup, not in custom bash scripts or CI tool config. This also has the desirable consequence that all developers can test the build using just bazel.
  • it is fast

Recipe List

Recipe Description
gcp_cloud_function Building and testing a GCP cloud function
go_openapi_service Building and testing a OpenAPI 3 service using golang
integration_test_with_services Building a container that includes dependencies (in this case PostgreSQL)
turps Building a golang grpc service, with e2e acceptance tests in a container
java_in_container Building a java application in a container
clojure_in_container Building a clojure application in a container

Motivation

The motivation for these recipes is that there is a shortage of small + public bazel examples. This has a few consequences:

  • reproducing issues requires new examples to be built from scratch every time
  • people trying to adopt bazel have to work from first principles not from working solutions.

More recipes will be added over time.

Other resources

About

Recipes useful in using bazel as the main component of a continuous integration build

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published