Skip to content

Conversation

@mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Dec 12, 2025

Implements buf-based protobuf linting with Azure Pipelines CI and Bazel integration using rules_buf v0.5.2. Supports both bzlmod (MODULE.bazel) and WORKSPACE build modes. All proto files are formatted according to buf standards.

Changes

Buf configuration

  • buf.yaml: v2 config with STANDARD linting rules, excludes bazel build artifacts
  • buf.lock: pins dependencies (googleapis, protoc-gen-validate, cel-spec)
  • Applied buf formatting to all proto files (import ordering, spacing, multi-line field options)

Bazel integration

  • MODULE.bazel: added rules_buf v0.5.2 dependency for bzlmod
  • bazel/repositories.bzl: added rules_buf to WORKSPACE dependencies
  • bazel/repository_locations.bzl: pinned rules_buf v0.5.2 release tarball with SHA256
  • bazel/dependency_imports.bzl: initialized rules_buf toolchains with buf v1.47.2
  • bazel/api_build_system.bzl: integrated buf_lint_test into xds_proto_package() macro
  • BUILD: added repository-wide buf_lint_test and buf_format targets

Each proto package now automatically gets a pkg_buf_lint_test target:

# In any BUILD file using xds_proto_package()
xds_proto_package()  # Generates pkg, pkg_cc_proto, pkg_go_proto, pkg_buf_lint_test

Buf rules available

  • buf_lint_test: Linting for proto files (runs automatically in CI via bazel test //...)
  • buf_format: Format proto files with bazel run //:buf_format (available but not enforced in CI)

CI workflow (Azure Pipelines)

  • Uses existing bazel test --config=ci //... command in ci/check.sh
  • All buf_lint_test targets run automatically through Bazel
  • Buf binary provided by rules_buf toolchain (no manual installation needed)
  • Follows best practices from buf.build documentation

Closes #47
Closes #45

@mmorel-35 mmorel-35 marked this pull request as ready for review December 12, 2025 21:18
@mmorel-35 mmorel-35 force-pushed the rules_buf branch 3 times, most recently from 3516726 to 0fff402 Compare December 13, 2025 07:22
@mmorel-35 mmorel-35 marked this pull request as draft December 14, 2025 09:04
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
@mmorel-35 mmorel-35 marked this pull request as ready for review December 14, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add buf linting

1 participant