Unset ANDROID_HOME and ANDROID_NDK_HOME on the macos platform (#2882)
Our Intel Mac machines (`macos` platform) have an outdated Android SDK
that doesn't work with the latest rules_android, so unset `ANDROID_HOME`
and `ANDROID_NDK_HOME` for all builds on that platform.
The variables are unset before the task's `environment` is applied, so
pipelines can still set them explicitly if needed. `macos_arm64` is
unaffected.
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 52e263e..c3d862b 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -1602,6 +1602,13 @@
# (https://github.com/bazelbuild/bazelisk).
test_env_vars.append("USE_BAZEL_VERSION")
+ # The Intel Mac machines have an outdated Android SDK that doesn't work with the latest
+ # rules_android, so we unset the Android env vars there. Pipelines can still set them
+ # explicitly via the "environment" field below.
+ if platform == "macos":
+ for e in ("ANDROID_HOME", "ANDROID_NDK_HOME"):
+ os.environ.pop(e, None)
+
for key, value in task_config.get("environment", {}).items():
# We have to explicitly convert the value to a string, because sometimes YAML tries to
# be smart and converts strings like "true" and "false" to booleans.