Add --script flag to bazelci.py (#646)
This flag is meant for testing, since it allows the user to specify the URL of the bazelci.py file that should be retrieved by runner steps.
As a result, the URL can be easily specified in the pipeline configuration instead of having to replace the URL in the file itself.
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index f9eb227..0e2c2ff 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -398,6 +398,8 @@
CONFIG_FILE_EXTENSIONS = set([".yml", ".yaml"])
+SCRIPT_URL = "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazelci.py"
+
class BuildkiteException(Exception):
"""
@@ -514,9 +516,7 @@
"""
URL to the latest version of this script.
"""
- return "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazelci.py?{}".format(
- int(time.time())
- )
+ return "{}?{}".format(SCRIPT_URL, int(time.time()))
def incompatible_flag_verbose_failures_url():
@@ -2377,6 +2377,7 @@
yaml.add_representer(str, str_presenter)
parser = argparse.ArgumentParser(description="Bazel Continuous Integration Script")
+ parser.add_argument("--script", type=str)
subparsers = parser.add_subparsers(dest="subparsers_name")
@@ -2436,6 +2437,10 @@
args = parser.parse_args(argv)
+ if args.script:
+ global SCRIPT_URL
+ SCRIPT_URL = args.script
+
try:
if args.subparsers_name == "bazel_publish_binaries_pipeline":
configs = fetch_configs(args.http_config, args.file_config)