bazel: re-organize bazelrc (#15522)

Replaced ci.bazelrc and v8-ci.bazelrc by custom configs inside the main
.bazelrc file. As a result, github workflows setup is simplified down to
a single '--config=<foo>' flag usage.

Moved the build metadata flags to config=ci.
Added custom tags metadata to help differentiate invocations based on
workflow (bazel vs v8) and os (linux/macos/windows).

Enabled users to override the default values in .bazelrc by using a
user.bazelrc file locally.
Added user.bazelrc to gitignore.
This commit is contained in:
Son Luong Ngoc
2026-03-27 06:50:07 +07:00
committed by GitHub
parent c264c6eef9
commit a27cd2d281
7 changed files with 59 additions and 38 deletions

View File

@@ -144,10 +144,7 @@ jobs:
bazel_args=(
test
--test_verbose_timeout_warnings
--build_metadata=REPO_URL=https://github.com/openai/codex.git
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)
--build_metadata=ROLE=CI
--build_metadata=VISIBILITY=PUBLIC
)
bazel_targets=(
@@ -164,6 +161,13 @@ jobs:
bazel_args+=("--test_env=CODEX_JS_REPL_NODE_PATH=${node_bin}")
fi
ci_config=ci-linux
if [[ "${RUNNER_OS:-}" == "macOS" ]]; then
ci_config=ci-macos
elif [[ "${RUNNER_OS:-}" == "Windows" ]]; then
ci_config=ci-windows
fi
if [[ -n "${BUILDBUDDY_API_KEY:-}" ]]; then
echo "BuildBuddy API key is available; using remote Bazel configuration."
# Work around Bazel 9 remote repo contents cache / overlay materialization failures
@@ -173,8 +177,8 @@ jobs:
set +e
bazel $BAZEL_STARTUP_ARGS \
--noexperimental_remote_repo_contents_cache \
--bazelrc=.github/workflows/ci.bazelrc \
"${bazel_args[@]}" \
"--config=${ci_config}" \
"--remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" \
-- \
"${bazel_targets[@]}" \