Fix string to boolean conversion in bazelci.py
* Fix string to boolean conversion in bazelci.py
I think the old code didn't actually work as intended - because os.environ can only contain strings, it didn't convert values like 'false' or '0' correctly.
* Address code review comments
* Update bazelci.py
@@ -970,11 +970,15 @@ def print_expanded_group(name):
eprint("\n\n+++ {0}\n\n".format(name))
+def is_trueish(s):
+ return str(s).lower() in ["true", "1", "t", "y", "yes"]
+
+
def use_bazelisk_migrate():
"""
If USE_BAZELISK_MIGRATE is set, we use `bazelisk --migrate` to test incompatible flags.
"""
- return bool(os.environ.get("USE_BAZELISK_MIGRATE"))
+ return is_trueish(os.environ.get("USE_BAZELISK_MIGRATE"))
def bazelisk_flags():
