Skip to content

Commit ede572e

Browse files
authored
bcr_compatibility: Support selecting top modules from BCR (#2094)
1 parent ab3f2a6 commit ede572e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

buildkite/bazel-central-registry/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ A new build can be triggered via the [BCR Bazel Compatibility Test](https://buil
2626

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

29+
* `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.
30+
2931
* `SMOKE_TEST_PERCENTAGE`: (Optional) Specifies a percentage of selected modules to be randomly sampled for smoke testing.
3032

3133
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.

buildkite/bazel-central-registry/bcr_compatibility.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ def select_modules_from_env_vars():
6565
MODULE_SELECTIONS = os.environ.get('MODULE_SELECTIONS', '')
6666
SMOKE_TEST_PERCENTAGE = os.environ.get('SMOKE_TEST_PERCENTAGE', None)
6767

68+
top_n = os.environ.get('SELECT_TOP_BCR_MODULES')
69+
if top_n:
70+
output = subprocess.check_output(
71+
["bazel", "run", "//tools:module_analyzer", "--", "--name-only", f"--top_n={top_n}"],
72+
)
73+
top_modules = output.decode("utf-8").split()
74+
MODULE_SELECTIONS = ','.join([f"{module}@latest" for module in top_modules])
75+
6876
if not MODULE_SELECTIONS:
6977
return []
7078

0 commit comments

Comments
 (0)