Avoid generate duplicated tasks (#2093)
Previously, bazel version defined in the matrix was still expanded via
the "old_bazel" attributes, leading to duplicated tasks:
-
https://buildkite.com/bazel/bcr-bazel-compatibility-test/builds/22#0192d96c-70d2-4057-a659-c9944b421a0b
-
https://buildkite.com/bazel/bcr-bazel-compatibility-test/builds/22#0192d96c-70dc-458b-bd72-637d99898ac5
This PR flattens bazel versions in the matrix to a single string to
avoid that while still keeping a nice warning message like
```
Bazel version overridden from 6.x, 7.x to 8.0.0rc2
```
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 3a56806..8214e9f 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -1042,6 +1042,10 @@
for task in config.get("tasks", {}):
config["tasks"][task]["old_bazel"] = config["tasks"][task].get("bazel")
config["tasks"][task]["bazel"] = bazel_version
+ matrix = config.get("matrix", {})
+ if "bazel" in matrix:
+ # This will only apply to "old_bazel" and avoid generating multiple tasks with the same config
+ matrix["bazel"] = [", ".join(matrix["bazel"])]
def load_config(http_url, file_config, allow_imports=True, bazel_version=None):