Skip to content

Start enforcing BUILD.bazel file formatting within bazel on some files#2825

Merged
Databean merged 6 commits into
google:mainfrom
Databean:bazel_test_buildifier
Jul 9, 2026
Merged

Start enforcing BUILD.bazel file formatting within bazel on some files#2825
Databean merged 6 commits into
google:mainfrom
Databean:bazel_test_buildifier

Conversation

@Databean

@Databean Databean commented Jul 8, 2026

Copy link
Copy Markdown
Member

We currently have a github action that enforces BUILD.bazel file formatting. It would be better if this validation happened within bazel itself, so developers can locally run bazel test //... to validate BUILD.bazel files without needing to go to GitHub.

This has the downside that buildifier will sometimes try to fix files in-place, which does not work and fails with this opaque error:

FAIL: //:cf_build_test (Exit 1) (see <path redacted>/test.log)
INFO: From Testing //:cf_build_test:
==================== Test output for //:cf_build_test:
buildifier: open MODULE.bazel: read-only file system
================================================================================

Opening <path redacted>/test.log does not have more information besides what is shown in the error.

Bug: b/532697459

@Databean Databean requested a review from cjreynol July 8, 2026 23:40
Comment thread base/cvd/cuttlefish/bazel/rules.bzl Outdated
Comment thread base/cvd/MODULE.bazel
@Databean Databean force-pushed the bazel_test_buildifier branch from cbd9818 to 544b3d9 Compare July 9, 2026 00:44
@Databean

Databean commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Thanks for reviewing!

@Databean Databean enabled auto-merge July 9, 2026 00:44
@Databean Databean added this pull request to the merge queue Jul 9, 2026
@Databean Databean removed this pull request from the merge queue due to a manual request Jul 9, 2026
Databean added 6 commits July 8, 2026 19:31
Build format tests are currently run through github actions. Making it
part of the bazel build will make it easier to reproduce and iterate on
locally.

Bug: b/532697459
This is more concise to use.

Bug: b/532697459
@Databean Databean force-pushed the bazel_test_buildifier branch from 544b3d9 to cda02ff Compare July 9, 2026 02:32
@Databean Databean enabled auto-merge July 9, 2026 03:23
@Databean Databean added this pull request to the merge queue Jul 9, 2026
Merged via the queue into google:main with commit cb42773 Jul 9, 2026
33 of 35 checks passed
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.

2 participants