Skip to content

Commit

Permalink
bcr_compatibility: Support selecting top modules from BCR (bazelbuild…
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorcloudy authored Oct 31, 2024
1 parent ab3f2a6 commit ede572e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions buildkite/bazel-central-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ A new build can be triggered via the [BCR Bazel Compatibility Test](https://buil

Examples: `[email protected],rules_java@latest`, `rules_*@latest`, `protobuf@<29.0-rc1`

* `SELECT_TOP_BCR_MODULES`: (Optional) Set this env var to select the top N most important modules from the BCR for testing (based on their PageRank values). This will override the `MODULE_SELECTIONS` env var.

* `SMOKE_TEST_PERCENTAGE`: (Optional) Specifies a percentage of selected modules to be randomly sampled for smoke testing.

For example, if `MODULE_SELECTIONS=rules_*@latest` and `SMOKE_TEST_PERCENTAGE=10`, then 10% of modules with name starting with `rules_` will be randomly selected.
Expand Down
8 changes: 8 additions & 0 deletions buildkite/bazel-central-registry/bcr_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def select_modules_from_env_vars():
MODULE_SELECTIONS = os.environ.get('MODULE_SELECTIONS', '')
SMOKE_TEST_PERCENTAGE = os.environ.get('SMOKE_TEST_PERCENTAGE', None)

top_n = os.environ.get('SELECT_TOP_BCR_MODULES')
if top_n:
output = subprocess.check_output(
["bazel", "run", "//tools:module_analyzer", "--", "--name-only", f"--top_n={top_n}"],
)
top_modules = output.decode("utf-8").split()
MODULE_SELECTIONS = ','.join([f"{module}@latest" for module in top_modules])

if not MODULE_SELECTIONS:
return []

Expand Down

0 comments on commit ede572e

Please sign in to comment.