diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 5b25a1b600ed74..7105ecef6783f6 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -241,6 +241,7 @@ tasks: setup: - mkdir C:\b - mklink /J C:\b\bazeltest_external %OUTPUT_BASE:/=\%\external + - START "" C:\python3\python.exe third_party/local-bazel-registry/server.py build_flags: - "--config=ci-windows" build_targets: @@ -292,6 +293,7 @@ tasks: setup: - mkdir C:\b - mklink /J C:\b\bazeltest_external %OUTPUT_BASE:/=\%\external + - START "" C:\python3\python.exe -m http.server 8000 --directory third_party/local-bazel-registry/ build_flags: - "--config=ci-windows" - "--config=windows_arm64" diff --git a/third_party/local-bazel-registry/server.py b/third_party/local-bazel-registry/server.py new file mode 100644 index 00000000000000..50b079546ce190 --- /dev/null +++ b/third_party/local-bazel-registry/server.py @@ -0,0 +1,23 @@ +import http.server +import sys +import threading +import time + +DIRECTORY = "./third_party/local-bazel-registry" + +class Handler(http.server.SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, directory=DIRECTORY, **kwargs) + +def _serve(httpd): + httpd.serve_forever() + +print("creating server...") +httpd = http.server.HTTPServer(('localhost', 8000), Handler) +t = threading.Thread(target=_serve, name="httpserver", args=(httpd,)) +print("starting server") +t.start() +print("server started, waiting for 10 mins") +t.join(600) +print("shutting down...") +httpd.shutdown() \ No newline at end of file