From f0a66e2cd859cd25bfea0224f03e85df37c35659 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Mon, 14 Oct 2019 12:45:42 +0200 Subject: [PATCH] Always pass USE_BAZEL_VERSION as --test_env when it exists (#846) * Always pass USE_BAZEL_VERSION as --test_env when it exists * Make sure USE_BAZEL_VERSION points to the actual Bazel binary we want to use Change-Id: I67928007a1117ebbfa096eceb96d7b4b8508fc07 --- buildkite/bazelci.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py index ddca51b396..7832b38ca3 100755 --- a/buildkite/bazelci.py +++ b/buildkite/bazelci.py @@ -795,16 +795,19 @@ def execute_commands( bazel_binary = download_bazel_binary_at_commit( tmpdir, binary_platform, use_bazel_at_commit ) + os.environ["USE_BAZEL_VERSION"] = bazel_binary elif use_but: print_collapsed_group(":gcloud: Downloading Bazel Under Test") bazel_binary = download_bazel_binary(tmpdir, binary_platform) + os.environ["USE_BAZEL_VERSION"] = bazel_binary else: bazel_binary = "bazel" if bazel_version: - # This will only work if the bazel binary in $PATH is actually a bazelisk binary - # (https://github.com/bazelbuild/bazelisk). os.environ["USE_BAZEL_VERSION"] = bazel_version - test_env_vars.append("USE_BAZEL_VERSION") + if "USE_BAZEL_VERSION" in os.environ: + # This will only work if the bazel binary in $PATH is actually a bazelisk binary + # (https://github.com/bazelbuild/bazelisk). + test_env_vars.append("USE_BAZEL_VERSION") for key, value in task_config.get("environment", {}).items(): # We have to explicitly convert the value to a string, because sometimes YAML tries to