From 39e0f06de1b91c2593c0c4177370b1e30b3ae397 Mon Sep 17 00:00:00 2001 From: Sreenithi Sridharan Date: Tue, 13 Aug 2024 08:24:44 -0700 Subject: [PATCH] [fix grpc_build_protobuf_at_head test timeout] added bazel override for protobuf in build_python.sh (#37404) Fix for grpc_build_protobuf_at_head -> python_linux_opt_native_buildonly timeout Found the following error during Python build: ![Screenshot 2024-08-02 12 16 54 PM](https://github.com/user-attachments/assets/8a57d770-dedb-4e6c-8117-b2b498d72657) When we mount and reuse the existing repo from host machine inside docker container, the `tools/bazel.rc` file is shared to the docker container and the Bazel override host location written to `tools/bazel.rc` from tools/.../grpc_build_submodule_at_head.sh (outside docker container) forces bazel to look for the same host location inside the docker container, which doesn't exist. Hence overriding it again with the working directory inside the container should solve this issue. Closes #37404 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37404 from sreenithi:fix_build_protobuf_at_head_timeout cae74938ffd5d691f8126022b0ab9e2e08a63193 PiperOrigin-RevId: 662526169 --- .../linux/grpc_build_submodule_at_head.sh | 5 +---- tools/run_tests/helper_scripts/build_python.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/internal_ci/linux/grpc_build_submodule_at_head.sh b/tools/internal_ci/linux/grpc_build_submodule_at_head.sh index 92df3390ead..fe2844891c7 100755 --- a/tools/internal_ci/linux/grpc_build_submodule_at_head.sh +++ b/tools/internal_ci/linux/grpc_build_submodule_at_head.sh @@ -36,7 +36,6 @@ echo "This suite tests whether gRPC HEAD builds with HEAD of submodule '${SUBMOD echo "If a test breaks, either" echo "1) some change in the grpc repository has caused the failure" echo "2) some change that was just merged in the submodule head has caused the failure." - echo "" echo "submodule '${SUBMODULE_NAME}' is at commit: $(cd third_party/${SUBMODULE_NAME}; git rev-parse --verify HEAD)" echo "" @@ -51,8 +50,6 @@ case "$SUBMODULE_NAME" in ;; protobuf) BAZEL_DEP_NAME="com_google_protobuf" - # TODO(xuanwang-amos): Remove the following once python test gets fixed for protobuf-at-head test. - EXTRA_EXCLUDE_FILTER="python" ;; esac if [ -z "$BAZEL_DEP_NAME" ] @@ -90,4 +87,4 @@ tools/buildgen/generate_projects.sh git add -A git -c user.name='foo' -c user.email='foo@google.com' commit -m 'Update submodule' --allow-empty -tools/run_tests/run_tests_matrix.py -f linux --exclude c sanity basictests_arm64 openssl dbg $EXTRA_EXCLUDE_FILTER --inner_jobs 16 -j 2 --build_only +tools/run_tests/run_tests_matrix.py -f linux --exclude c sanity basictests_arm64 openssl dbg --inner_jobs 16 -j 2 --build_only diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh index f911af171d2..3dd4bd3c6c0 100755 --- a/tools/run_tests/helper_scripts/build_python.sh +++ b/tools/run_tests/helper_scripts/build_python.sh @@ -86,6 +86,19 @@ function toolchain() { fi } +# When we mount and reuse the existing repo from host machine inside docker +# container, the `tools/bazel.rc` file is shared to the docker container and +# the Bazel override written to `bazel.rc` from tools/.../grpc_build_submodule_at_head.sh +# (outside docker container) forces bazel to look for the same host location +# inside the docker container, which doesn't exist. +# Hence overriding it again with the working directory inside the container +# should solve this issue +BAZEL_DEP_PATH="$(pwd)/third_party/protobuf" +BAZEL_DEP_NAME="com_google_protobuf" +echo "bazel override_repository is set for ${BAZEL_DEP_NAME} to ${BAZEL_DEP_PATH}" +echo "build --override_repository=${BAZEL_DEP_NAME}=${BAZEL_DEP_PATH}" >> "tools/bazel.rc" +echo "query --override_repository=${BAZEL_DEP_NAME}=${BAZEL_DEP_PATH}" >> "tools/bazel.rc" + #################### # Script Arguments # ####################