From ab3f2a64b830cb36da8a5cb2b03da9e854d09a29 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Wed, 30 Oct 2024 15:15:22 +0100 Subject: [PATCH] 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 ``` --- buildkite/bazelci.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py index 3a568063fa..8214e9f9df 100755 --- a/buildkite/bazelci.py +++ b/buildkite/bazelci.py @@ -1042,6 +1042,10 @@ def maybe_overwrite_bazel_version(bazel_version, config): 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):