mirror of
https://github.com/openai/codex.git
synced 2026-10-25 18:28:38 +00:00
codex: fix CI failure on PR #26222
This commit is contained in:
@@ -28,11 +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,
|
||||
enable_remote_config=False,
|
||||
)
|
||||
return bazel_command(*query_args, env=env)
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None, env: Mapping[str, str] | None = None) -> int:
|
||||
|
||||
@@ -152,15 +152,10 @@ def bazel_args_with_remote_config(
|
||||
return [*args[:insertion_idx], *remote_args, *args[insertion_idx:]]
|
||||
|
||||
|
||||
def bazel_command(
|
||||
*args: str,
|
||||
env: Mapping[str, str] | None = None,
|
||||
enable_remote_config: bool = True,
|
||||
) -> list[str]:
|
||||
def bazel_command(*args: str, env: Mapping[str, str] | None = None) -> list[str]:
|
||||
env = os.environ if env is None else env
|
||||
bazel = env.get("CODEX_BAZEL_BIN", "bazel")
|
||||
bazel_args = bazel_args_with_remote_config(args, env) if enable_remote_config else args
|
||||
return [bazel, *startup_args(args, env), *bazel_args]
|
||||
return [bazel, *startup_args(args, env), *bazel_args_with_remote_config(args, env)]
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
@@ -33,6 +33,8 @@ class RunBazelQueryCiTest(unittest.TestCase):
|
||||
"--output_user_root=/tmp/output",
|
||||
"--noexperimental_remote_repo_contents_cache",
|
||||
"query",
|
||||
"--config=buildbuddy-generic",
|
||||
"--remote_header=x-buildbuddy-api-key=token",
|
||||
"--repo_contents_cache=/tmp/contents",
|
||||
"--repository_cache=/tmp/repository",
|
||||
"--keep_going",
|
||||
@@ -47,7 +49,7 @@ class RunBazelQueryCiTest(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, "Usage:"):
|
||||
run_bazel_query_ci.query_command(args, {})
|
||||
|
||||
def test_main_runs_query_without_buildbuddy_configuration(self) -> None:
|
||||
def test_main_runs_query_with_buildbuddy_configuration(self) -> None:
|
||||
with TemporaryDirectory() as temp_dir:
|
||||
temp = Path(temp_dir)
|
||||
args_path = temp / "args.json"
|
||||
@@ -91,6 +93,8 @@ class RunBazelQueryCiTest(unittest.TestCase):
|
||||
[
|
||||
"--noexperimental_remote_repo_contents_cache",
|
||||
"query",
|
||||
"--config=buildbuddy-generic",
|
||||
"--remote_header=x-buildbuddy-api-key=token",
|
||||
"--output=label",
|
||||
"//codex-rs/...",
|
||||
],
|
||||
|
||||
@@ -214,20 +214,6 @@ class RunBazelWithBuildBuddyTest(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
def test_bazel_command_can_explicitly_disable_remote_configuration(self) -> None:
|
||||
self.assertEqual(
|
||||
run_bazel_with_buildbuddy.bazel_command(
|
||||
"query",
|
||||
"//codex-rs/...",
|
||||
env={
|
||||
"BUILDBUDDY_API_KEY": "token",
|
||||
"CODEX_BAZEL_BIN": "fake-bazel",
|
||||
},
|
||||
enable_remote_config=False,
|
||||
),
|
||||
["fake-bazel", "query", "//codex-rs/..."],
|
||||
)
|
||||
|
||||
def test_main_preserves_spaced_argument_and_child_exit_status(self) -> None:
|
||||
spaced_arg = (
|
||||
r"--test_env=PATH=C:\Program Files\PowerShell\7;C:\Program Files\Git\bin"
|
||||
|
||||
Reference in New Issue
Block a user