Use correct settings in IPv6 networks (#1809)

Bazel requires additional flags when running in an IPv6-only network.

Progress towards
https://github.com/bazelbuild/continuous-integration/issues/1708
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 6612d84..399726b 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -894,6 +894,10 @@
     return any(p.match(agent) for p in LAB_AGENT_PATTERNS)
 
 
+def is_ipv6_mac():
+    return is_mac() and not is_lab_machine()
+
+
 def gsutil_command():
     return "gsutil.cmd" if is_windows() else "gsutil"
 
@@ -1872,8 +1876,9 @@
         platform_cache_digest.update(key)
         platform_cache_digest.update(b":")
 
+    remote_timeout = 600 if is_ipv6_mac() else 60
     flags += [
-        "--remote_timeout=60",
+        f"--remote_timeout={remote_timeout}",
         "--remote_max_connections=200",
         '--remote_default_platform_properties=properties:{name:"cache-silo-key" value:"%s"}'
         % platform_cache_digest.hexdigest(),
@@ -1921,6 +1926,8 @@
         else:
             # This machine uses its PD-SSD as the build directory.
             return ["--output_user_root=C:/b"]
+    elif is_ipv6_mac():
+        return ["--host_jvm_args=-Djava.net.preferIPv6Addresses=true"]
     return []
 
 
@@ -1956,6 +1963,9 @@
             "--build_event_json_file=" + bep_file,
         ]
 
+    if is_ipv6_mac():
+        flags += ["--jvmopt=-Djava.net.preferIPv6Addresses"]
+
     return flags