Allow users to override incompatible flags to be tested (#445)
You can set INCOMPATIBLE_FLAGS environment variable when creating a new
build in the Bazel@Release + Incompatible flags pipeline to override the
incompatible flags it will test.
eg, INCOMPATIBLE_FLAGS="--incompatible_foo_bar --incompatible_foo_foo"
Change-Id: I7364470a590e1d2b26b33574ebd6e9238826dd79
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 3ef242d..a20d481 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -1322,10 +1322,20 @@
)
-def fetch_incompatible_flags_from_github():
+def fetch_incompatible_flags():
"""
Return a list of incompatible flags to be tested in downstream with the current release Bazel
"""
+ incompatible_flags = {}
+
+ # If INCOMPATIBLE_FLAGS environment variable is set, we get incompatible flags from it.
+ if "INCOMPATIBLE_FLAGS" in os.environ:
+ for flag in os.environ["INCOMPATIBLE_FLAGS"].split():
+ # We are not able to get the github link for this flag from INCOMPATIBLE_FLAGS,
+ # so just assign the url to empty string.
+ incompatible_flags[flag] = ""
+ return incompatible_flags
+
# Get bazel major version on CI, eg. 0.21 from "Build label: 0.21.0\n..."
output = subprocess.check_output(
["bazel", "--nomaster_bazelrc", "--bazelrc=/dev/null", "version"]
@@ -1341,7 +1351,6 @@
).decode("utf-8")
issue_info = json.loads(output)
- incompatible_flags = {}
for issue in issue_info["items"]:
# Every incompatible flags issue should start with "<incompatible flag name (without --)>:"
name = "--" + issue["title"].split(":")[0]
@@ -1384,7 +1393,7 @@
incompatible_flags = None
if test_incompatible_flags:
- incompatible_flags_map = fetch_incompatible_flags_from_github()
+ incompatible_flags_map = fetch_incompatible_flags()
info_box_step = print_incompatible_flags_info_box_step(incompatible_flags_map)
if info_box_step is not None:
pipeline_steps.append(info_box_step)