mirror of
https://github.com/openai/codex.git
synced 2026-09-05 15:18:41 +00:00
ci: delegate Bazel launches to shared wrapper
This commit is contained in:
11
.github/scripts/run_bazel_ci.py
vendored
11
.github/scripts/run_bazel_ci.py
vendored
@@ -16,7 +16,7 @@ from tempfile import NamedTemporaryFile
|
||||
from typing import TextIO
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
from run_bazel_with_buildbuddy import bazel_command
|
||||
from run_bazel_with_buildbuddy import buildbuddy_wrapper_command
|
||||
|
||||
|
||||
USAGE = (
|
||||
@@ -198,13 +198,12 @@ def build_invocation(
|
||||
startup_args = []
|
||||
if output_user_root := env.get("BAZEL_OUTPUT_USER_ROOT"):
|
||||
startup_args.append(f"--output_user_root={output_user_root}")
|
||||
command = bazel_command(
|
||||
command = buildbuddy_wrapper_command(
|
||||
*startup_args,
|
||||
"--noexperimental_remote_repo_contents_cache",
|
||||
*run_args,
|
||||
"--",
|
||||
*targets,
|
||||
env=env,
|
||||
)
|
||||
child_env = dict(env)
|
||||
if env.get("RUNNER_OS") == "Windows":
|
||||
@@ -308,14 +307,10 @@ def bazel_testlogs_dir(invocation: Invocation) -> Path:
|
||||
for arg in invocation.post_config_args
|
||||
if arg.startswith(INFO_POST_CONFIG_PREFIXES)
|
||||
)
|
||||
command = bazel_command(
|
||||
*(
|
||||
[arg for arg in invocation.command[1:] if arg.startswith("--output_user_root=")]
|
||||
),
|
||||
command = buildbuddy_wrapper_command(
|
||||
"--noexperimental_remote_repo_contents_cache",
|
||||
*info_args,
|
||||
"bazel-testlogs",
|
||||
env=invocation.child_env,
|
||||
)
|
||||
result = subprocess.run(
|
||||
command,
|
||||
|
||||
4
.github/scripts/run_bazel_query_ci.py
vendored
4
.github/scripts/run_bazel_query_ci.py
vendored
@@ -10,7 +10,7 @@ from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
from run_bazel_with_buildbuddy import bazel_command
|
||||
from run_bazel_with_buildbuddy import buildbuddy_wrapper_command
|
||||
|
||||
|
||||
USAGE = "Usage: run_bazel_query_ci.py [<bazel query args>...] -- <query expression>"
|
||||
@@ -28,7 +28,7 @@ def query_command(args: Sequence[str], env: Mapping[str, str]) -> list[str]:
|
||||
query_args.extend(args[:-2])
|
||||
query_args.append(args[-1])
|
||||
|
||||
return bazel_command(*query_args, env=env)
|
||||
return buildbuddy_wrapper_command(*query_args)
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None, env: Mapping[str, str] | None = None) -> int:
|
||||
|
||||
4
.github/scripts/run_bazel_with_buildbuddy.py
vendored
4
.github/scripts/run_bazel_with_buildbuddy.py
vendored
@@ -158,6 +158,10 @@ def bazel_command(*args: str, env: Mapping[str, str] | None = None) -> list[str]
|
||||
return [bazel, *startup_args(args, env), *bazel_args_with_remote_config(args, env)]
|
||||
|
||||
|
||||
def buildbuddy_wrapper_command(*args: str) -> list[str]:
|
||||
return [sys.executable, str(Path(__file__).resolve()), *args]
|
||||
|
||||
|
||||
def main() -> None:
|
||||
config = remote_config(sys.argv[1:], os.environ)
|
||||
if config is None:
|
||||
|
||||
6
.github/scripts/test_run_bazel_ci.py
vendored
6
.github/scripts/test_run_bazel_ci.py
vendored
@@ -13,6 +13,7 @@ from tempfile import TemporaryDirectory
|
||||
from unittest.mock import patch
|
||||
|
||||
import run_bazel_ci
|
||||
import run_bazel_with_buildbuddy
|
||||
|
||||
|
||||
class RunBazelCiTest(unittest.TestCase):
|
||||
@@ -56,12 +57,11 @@ class RunBazelCiTest(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
invocation.command,
|
||||
[
|
||||
"fake-bazel",
|
||||
sys.executable,
|
||||
str(Path(run_bazel_with_buildbuddy.__file__).resolve()),
|
||||
"--output_user_root=/tmp/output",
|
||||
"--noexperimental_remote_repo_contents_cache",
|
||||
"test",
|
||||
"--config=buildbuddy-generic-rbe",
|
||||
"--remote_header=x-buildbuddy-api-key=token",
|
||||
"--keep_going",
|
||||
"--config=ci-linux",
|
||||
"--remote_download_toplevel",
|
||||
|
||||
8
.github/scripts/test_run_bazel_query_ci.py
vendored
8
.github/scripts/test_run_bazel_query_ci.py
vendored
@@ -10,6 +10,7 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
import run_bazel_query_ci
|
||||
import run_bazel_with_buildbuddy
|
||||
|
||||
|
||||
class RunBazelQueryCiTest(unittest.TestCase):
|
||||
@@ -29,12 +30,9 @@ class RunBazelQueryCiTest(unittest.TestCase):
|
||||
},
|
||||
),
|
||||
[
|
||||
"fake-bazel",
|
||||
"--output_user_root=/tmp/output",
|
||||
"--noexperimental_remote_repo_contents_cache",
|
||||
sys.executable,
|
||||
str(Path(run_bazel_with_buildbuddy.__file__).resolve()),
|
||||
"query",
|
||||
"--config=buildbuddy-generic",
|
||||
"--remote_header=x-buildbuddy-api-key=token",
|
||||
"--repo_contents_cache=/tmp/contents",
|
||||
"--repository_cache=/tmp/repository",
|
||||
"--keep_going",
|
||||
|
||||
Reference in New Issue
Block a user