From cb235a3e22c36236e9aa92e69398e8c3d15e3043 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 7 Aug 2023 16:14:17 +0200 Subject: [PATCH] [bazel] Add bazelified run_tests.py tests for ruby and python (#33959) Context: https://github.com/grpc/grpc/pull/33707 Add python and ruby tests. Both required a few fixes so I wanted to add them separately from https://github.com/grpc/grpc/pull/33707 Manual run of all the tests: https://source.cloud.google.com/results/invocations/24c7b6ed-a8b3-4367-a4bf-8828919a9340 --- .../dockerfile/passwordless_sudo.include | 6 ++ templates/tools/dockerfile/ruby_deps.include | 3 +- .../Dockerfile.template | 3 + .../Dockerfile.template | 3 + .../ruby_debian11_x64/Dockerfile.template | 1 + .../dockerimage_current_versions.bzl | 10 +-- tools/bazelify_tests/test/BUILD | 70 +++++++++---------- .../bazelify_tests/test/portability_tests.bzl | 19 +++-- tools/bazelify_tests/test/prepare_ruby.sh | 18 +++++ .../grpc_interop_ruby.current_version | 2 +- .../interoptest/grpc_interop_ruby/Dockerfile | 3 +- ...hon_debian11_default_arm64.current_version | 2 +- .../python_debian11_default_arm64/Dockerfile | 3 + ...ython_debian11_default_x64.current_version | 2 +- .../python_debian11_default_x64/Dockerfile | 3 + .../test/ruby_debian11_arm64.current_version | 2 +- .../test/ruby_debian11_arm64/Dockerfile | 3 +- .../test/ruby_debian11_x64.current_version | 2 +- .../test/ruby_debian11_x64/Dockerfile | 10 ++- tools/run_tests/helper_scripts/build_ruby.sh | 2 +- 20 files changed, 106 insertions(+), 61 deletions(-) create mode 100644 templates/tools/dockerfile/passwordless_sudo.include create mode 100755 tools/bazelify_tests/test/prepare_ruby.sh diff --git a/templates/tools/dockerfile/passwordless_sudo.include b/templates/tools/dockerfile/passwordless_sudo.include new file mode 100644 index 00000000000..ee9fc2e4252 --- /dev/null +++ b/templates/tools/dockerfile/passwordless_sudo.include @@ -0,0 +1,6 @@ +# Passwordless sudo for all users +# Bazel docker sandbox and bazel RBE run scripts under docker +# as a regular user, but sometimes we need to be +# able to do something with root privileges. +RUN apt-get update && apt-get install -y sudo && apt-get clean +RUN echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers diff --git a/templates/tools/dockerfile/ruby_deps.include b/templates/tools/dockerfile/ruby_deps.include index b4a24bfb380..a57130f9bcc 100644 --- a/templates/tools/dockerfile/ruby_deps.include +++ b/templates/tools/dockerfile/ruby_deps.include @@ -8,7 +8,8 @@ RUN \curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.7 RUN apt-get update && apt-get install -y procps && apt-get clean -RUN /bin/bash -l -c "rvm install ruby-2.7" +# "--disable-binary" is a workaround for https://github.com/rvm/rvm/issues/4975 +RUN /bin/bash -l -c "rvm install ruby-2.7 --disable-binary" RUN /bin/bash -l -c "rvm use --default ruby-2.7" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" diff --git a/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template b/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template index ca6873105b7..26ae79b66d4 100644 --- a/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template @@ -25,6 +25,9 @@ # for Python test coverage reporting RUN python3.9 -m pip install coverage + # six is required by the run_tests.py test harness + RUN python3.9 -m pip install six + <%include file="../../gcp_api_libraries.include"/> <%include file="../../cmake.include"/> diff --git a/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template index 9a420cf267d..eee2289d134 100644 --- a/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template @@ -31,6 +31,9 @@ # for Python test coverage reporting RUN python3.9 -m pip install coverage + # six is required by the run_tests.py test harness + RUN python3.9 -m pip install six + <%include file="../../gcp_api_libraries.include"/> <%include file="../../cmake.include"/> diff --git a/templates/tools/dockerfile/test/ruby_debian11_x64/Dockerfile.template b/templates/tools/dockerfile/test/ruby_debian11_x64/Dockerfile.template index 52da8d5416f..9d24d767888 100644 --- a/templates/tools/dockerfile/test/ruby_debian11_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/ruby_debian11_x64/Dockerfile.template @@ -23,6 +23,7 @@ <%include file="../../ccache.include"/> <%include file="../../run_tests_addons.include"/> <%include file="../../xds_interop_deps.include"/> + <%include file="../../passwordless_sudo.include"/> # Define the default command. CMD ["bash"] diff --git a/tools/bazelify_tests/dockerimage_current_versions.bzl b/tools/bazelify_tests/dockerimage_current_versions.bzl index 79147f8ea08..074aeef5f6f 100644 --- a/tools/bazelify_tests/dockerimage_current_versions.bzl +++ b/tools/bazelify_tests/dockerimage_current_versions.bzl @@ -87,7 +87,7 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/interoptest/grpc_interop_php7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php7@sha256:09f4b895117c81506c423360b617917d06d3f7f0b78e4cca25eaec547ba6991e", "tools/dockerfile/interoptest/grpc_interop_python.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_python@sha256:fef1247f8256be2b9841331e7d21b0046da21a4a6d34a62addb36f62124725cf", "tools/dockerfile/interoptest/grpc_interop_pythonasyncio.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_pythonasyncio@sha256:bd4cdc8a71ef339193e178ce20d2b47a0b2aa25fc86c0b5740b9d86a2d4a0caa", - "tools/dockerfile/interoptest/grpc_interop_ruby.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby@sha256:0de52450b29cf91365e623b020cd97722c307510ba1813bee09264e0a49acdbc", + "tools/dockerfile/interoptest/grpc_interop_ruby.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby@sha256:596678dac1d736eae7fecd5fe718efcfd3dc637fe8adf626db86be7c7727b68b", "tools/dockerfile/interoptest/lb_interop_fake_servers.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/lb_interop_fake_servers@sha256:b89a51dd9147e1293f50ee64dd719fce5929ca7894d3770a3d80dbdecb99fd52", "tools/dockerfile/test/android_ndk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/android_ndk@sha256:2bddf36ae504968b35f97e4a6c9b74864473689e84049675c30afb70f868d897", "tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:1118150d9d9479787165fff49f660a3dc633f1c57604305460172fc1916aa022", @@ -108,10 +108,10 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/test/php7_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/php7_debian11_arm64@sha256:444e25f9e3a89c2438e4d5e6f3904c5a1f4d1fb961f8456333ebe3e36e301a4e", "tools/dockerfile/test/php7_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/php7_debian11_x64@sha256:018d422abf144fc93e9027fd994f7d6aab453fffbe4a669d622dd3d1c1fe9ee7", "tools/dockerfile/test/python_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64@sha256:d10159225ae25276b7ae7bfc4230150e4b0a8ce7be833d904bdd4ecdfdc91c6e", - "tools/dockerfile/test/python_debian11_default_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64@sha256:868cfb50e465f086b75bb65a7fab6d15b1edefabcd8c1826340acefb6ea1737f", - "tools/dockerfile/test/python_debian11_default_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64@sha256:4f29e539941d22b7abb911f9b6b3101ff5c7c4fb75585bfe3b7389251ea6be1d", + "tools/dockerfile/test/python_debian11_default_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64@sha256:b2b35321d91caa50ec25fd6eb5160afdd04c58ef18ac4d2a62b19177bbc6d00e", + "tools/dockerfile/test/python_debian11_default_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64@sha256:5e9278a10a8c338963fa258213910fc0dead6bac91110256c1a0a344e0ade58f", "tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:d3951aeadf43e3bee6adc5b86d26cdaf0b9d1b5baf790d7b2530d1c197adc9f8", - "tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:9503d80a40555aba4dd531b64354ad8036c6b37e162c93e7994ca23d89bc7d41", - "tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:3f01369c3e5707fa63007820b30461b9e32a4b729d81cb92d19669d7966a8584", + "tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:c4901beb737a6aed3969c7bc601cd441488e5283a6abfabb80210c1bd2f5cd19", + "tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:f30272c98928898b42903aa1a08fb0d769c8dc7b6173231a778c8c001b904219", "tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:189e07d8503aa15344e3c8f565783659c3e2edc5b8ca455ec427de1e29ef4504", } diff --git a/tools/bazelify_tests/test/BUILD b/tools/bazelify_tests/test/BUILD index a6eac298bed..bfdea293905 100644 --- a/tools/bazelify_tests/test/BUILD +++ b/tools/bazelify_tests/test/BUILD @@ -59,29 +59,28 @@ grpc_run_tests_py_test( docker_image_version = "tools/dockerfile/test/cxx_debian11_x64.current_version", ) -# TODO(jtattermusch): Reintroduce ruby tests once they pass. -# # Ruby -# grpc_run_tests_py_test( -# name = "runtests_ruby_linux_dbg", -# size = "enormous", -# args = [ -# "-l ruby -c dbg", -# ], -# docker_image_version = "tools/dockerfile/test/ruby_debian11_x64.current_version", -# prepare_script = ":prepare_ruby.sh", -# use_login_shell = True, # ruby's docker image uses RVM which wierdly requires login shell -# ) - -# grpc_run_tests_py_test( -# name = "runtests_ruby_linux_opt", -# size = "enormous", -# args = [ -# "-l ruby -c opt", -# ], -# docker_image_version = "tools/dockerfile/test/ruby_debian11_x64.current_version", -# prepare_script = ":prepare_ruby.sh", -# use_login_shell = True, # ruby's docker image uses RVM which wierdly requires login shell -# ) +# Ruby +grpc_run_tests_py_test( + name = "runtests_ruby_linux_dbg", + size = "enormous", + args = [ + "-l ruby -c dbg", + ], + docker_image_version = "tools/dockerfile/test/ruby_debian11_x64.current_version", + prepare_script = ":prepare_ruby.sh", + use_login_shell = True, # ruby's docker image uses RVM which wierdly requires login shell +) + +grpc_run_tests_py_test( + name = "runtests_ruby_linux_opt", + size = "enormous", + args = [ + "-l ruby -c opt", + ], + docker_image_version = "tools/dockerfile/test/ruby_debian11_x64.current_version", + prepare_script = ":prepare_ruby.sh", + use_login_shell = True, # ruby's docker image uses RVM which wierdly requires login shell +) # PHP grpc_run_tests_py_test( @@ -102,16 +101,15 @@ grpc_run_tests_py_test( docker_image_version = "tools/dockerfile/test/php7_debian11_x64.current_version", ) -# TODO(jtattermusch): Reintroduce python tests once they pass. -# # Python -# grpc_run_tests_py_test( -# name = "runtests_python_linux_opt", -# size = "enormous", -# args = [ -# "-l python -c opt", -# ], -# docker_image_version = "tools/dockerfile/test/python_debian11_default_x64.current_version", -# ) +# Python +grpc_run_tests_py_test( + name = "runtests_python_linux_opt", + size = "enormous", + args = [ + "-l python -c opt", + ], + docker_image_version = "tools/dockerfile/test/python_debian11_default_x64.current_version", +) # C# grpc_run_tests_py_test( @@ -144,9 +142,9 @@ test_suite( # TODO(jtattermusch): reenable the test once not flaky anymore #":runtests_php_linux_dbg", ":runtests_php_linux_opt", - #":runtests_python_linux_opt", - #":runtests_ruby_linux_dbg", - #":runtests_ruby_linux_opt", + ":runtests_python_linux_opt", + ":runtests_ruby_linux_dbg", + ":runtests_ruby_linux_opt", ], ) diff --git a/tools/bazelify_tests/test/portability_tests.bzl b/tools/bazelify_tests/test/portability_tests.bzl index 26afa9e5bea..4acc7d729dc 100644 --- a/tools/bazelify_tests/test/portability_tests.bzl +++ b/tools/bazelify_tests/test/portability_tests.bzl @@ -73,17 +73,16 @@ def generate_run_tests_portability_tests(name): ) test_names.append(test_name) - # TODO(jtattermusch): Reintroduce the test once it passes. # Python on alpine - #grpc_run_tests_py_test( - # name = "runtests_python_linux_dbg_alpine", - # args = [ - # "-l python -c dbg --compiler python_alpine", - # ], - # docker_image_version = "tools/dockerfile/test/python_alpine_x64.current_version", - # size = "enormous", - #) - #test_names.append("runtests_python_linux_dbg_alpine") + grpc_run_tests_py_test( + name = "runtests_python_linux_dbg_alpine", + args = [ + "-l python -c dbg --compiler python_alpine", + ], + docker_image_version = "tools/dockerfile/test/python_alpine_x64.current_version", + size = "enormous", + ) + test_names.append("runtests_python_linux_dbg_alpine") # Generate test suite that allows easily running all portability tests. native.test_suite( diff --git a/tools/bazelify_tests/test/prepare_ruby.sh b/tools/bazelify_tests/test/prepare_ruby.sh new file mode 100755 index 00000000000..a5baed7c039 --- /dev/null +++ b/tools/bazelify_tests/test/prepare_ruby.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 2023 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# make sure /usr/local/rvm is writable by ruby when running under docker as non-root +sudo chown -R "$(id -u)" /usr/local/rvm + diff --git a/tools/dockerfile/interoptest/grpc_interop_ruby.current_version b/tools/dockerfile/interoptest/grpc_interop_ruby.current_version index d6b04022087..9f6dbb4e59b 100644 --- a/tools/dockerfile/interoptest/grpc_interop_ruby.current_version +++ b/tools/dockerfile/interoptest/grpc_interop_ruby.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby:4abe304d586e1bc862cb85e9ac5e9c7b2f7ae73c@sha256:0de52450b29cf91365e623b020cd97722c307510ba1813bee09264e0a49acdbc \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby:a6f7413e822f23ea4b696afe916714ba3df5175c@sha256:596678dac1d736eae7fecd5fe718efcfd3dc637fe8adf626db86be7c7727b68b \ No newline at end of file diff --git a/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile index afae01d7b33..be4f96fa1f3 100644 --- a/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile @@ -88,7 +88,8 @@ RUN \curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.7 RUN apt-get update && apt-get install -y procps && apt-get clean -RUN /bin/bash -l -c "rvm install ruby-2.7" +# "--disable-binary" is a workaround for https://github.com/rvm/rvm/issues/4975 +RUN /bin/bash -l -c "rvm install ruby-2.7 --disable-binary" RUN /bin/bash -l -c "rvm use --default ruby-2.7" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" diff --git a/tools/dockerfile/test/python_debian11_default_arm64.current_version b/tools/dockerfile/test/python_debian11_default_arm64.current_version index 9b169fc51ac..a634823cee2 100644 --- a/tools/dockerfile/test/python_debian11_default_arm64.current_version +++ b/tools/dockerfile/test/python_debian11_default_arm64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64:faff3d19982d4a3f479a4d9633d28028834bc4df@sha256:868cfb50e465f086b75bb65a7fab6d15b1edefabcd8c1826340acefb6ea1737f \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64:cd3c1ca8dd1ff0e3496d603904d7d5d51ab8b1b8@sha256:b2b35321d91caa50ec25fd6eb5160afdd04c58ef18ac4d2a62b19177bbc6d00e \ No newline at end of file diff --git a/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile b/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile index 977de6aa994..a331f21cb1c 100644 --- a/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile +++ b/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile @@ -63,6 +63,9 @@ RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3-pip # for Python test coverage reporting RUN python3.9 -m pip install coverage +# six is required by the run_tests.py test harness +RUN python3.9 -m pip install six + # Google Cloud Platform API libraries # These are needed for uploading test results to BigQuery (e.g. by tools/run_tests scripts) RUN python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-client==1.12.8 oauth2client==4.1.0 diff --git a/tools/dockerfile/test/python_debian11_default_x64.current_version b/tools/dockerfile/test/python_debian11_default_x64.current_version index 4a8cfedcf8d..1b90c45d7d6 100644 --- a/tools/dockerfile/test/python_debian11_default_x64.current_version +++ b/tools/dockerfile/test/python_debian11_default_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64:31ceb004af0498642b186d28e5c6411b974c2c04@sha256:4f29e539941d22b7abb911f9b6b3101ff5c7c4fb75585bfe3b7389251ea6be1d \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64:14e1a18ec5d6bb304cfed659d4b4d5360b13b52c@sha256:5e9278a10a8c338963fa258213910fc0dead6bac91110256c1a0a344e0ade58f \ No newline at end of file diff --git a/tools/dockerfile/test/python_debian11_default_x64/Dockerfile b/tools/dockerfile/test/python_debian11_default_x64/Dockerfile index 582c7ca2f99..c2359ff9b97 100644 --- a/tools/dockerfile/test/python_debian11_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_debian11_default_x64/Dockerfile @@ -170,6 +170,9 @@ RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3-pip # for Python test coverage reporting RUN python3.9 -m pip install coverage +# six is required by the run_tests.py test harness +RUN python3.9 -m pip install six + # Google Cloud Platform API libraries # These are needed for uploading test results to BigQuery (e.g. by tools/run_tests scripts) RUN python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-client==1.12.8 oauth2client==4.1.0 diff --git a/tools/dockerfile/test/ruby_debian11_arm64.current_version b/tools/dockerfile/test/ruby_debian11_arm64.current_version index 986d9ffefcf..50940710a97 100644 --- a/tools/dockerfile/test/ruby_debian11_arm64.current_version +++ b/tools/dockerfile/test/ruby_debian11_arm64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64:215df896c707f55c3092a64afc4075c7a408b516@sha256:9503d80a40555aba4dd531b64354ad8036c6b37e162c93e7994ca23d89bc7d41 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64:cb472b623590186bc1d6e996cccb6fbb094e7e3a@sha256:c4901beb737a6aed3969c7bc601cd441488e5283a6abfabb80210c1bd2f5cd19 \ No newline at end of file diff --git a/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile b/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile index 65ea471b746..0189fc26798 100644 --- a/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile +++ b/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile @@ -88,7 +88,8 @@ RUN \curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.7 RUN apt-get update && apt-get install -y procps && apt-get clean -RUN /bin/bash -l -c "rvm install ruby-2.7" +# "--disable-binary" is a workaround for https://github.com/rvm/rvm/issues/4975 +RUN /bin/bash -l -c "rvm install ruby-2.7 --disable-binary" RUN /bin/bash -l -c "rvm use --default ruby-2.7" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" diff --git a/tools/dockerfile/test/ruby_debian11_x64.current_version b/tools/dockerfile/test/ruby_debian11_x64.current_version index 2f52045af70..a52d3b64bed 100644 --- a/tools/dockerfile/test/ruby_debian11_x64.current_version +++ b/tools/dockerfile/test/ruby_debian11_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64:05ff6c04182addf087f77b2515992e98b9c7a171@sha256:3f01369c3e5707fa63007820b30461b9e32a4b729d81cb92d19669d7966a8584 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64:b697ef647022cc3a14350ded1e01a52dfd9b8cf3@sha256:f30272c98928898b42903aa1a08fb0d769c8dc7b6173231a778c8c001b904219 \ No newline at end of file diff --git a/tools/dockerfile/test/ruby_debian11_x64/Dockerfile b/tools/dockerfile/test/ruby_debian11_x64/Dockerfile index eab09a00f30..a354804d71a 100644 --- a/tools/dockerfile/test/ruby_debian11_x64/Dockerfile +++ b/tools/dockerfile/test/ruby_debian11_x64/Dockerfile @@ -88,7 +88,8 @@ RUN \curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.7 RUN apt-get update && apt-get install -y procps && apt-get clean -RUN /bin/bash -l -c "rvm install ruby-2.7" +# "--disable-binary" is a workaround for https://github.com/rvm/rvm/issues/4975 +RUN /bin/bash -l -c "rvm install ruby-2.7 --disable-binary" RUN /bin/bash -l -c "rvm use --default ruby-2.7" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" @@ -121,6 +122,13 @@ RUN mkdir /var/local/jenkins # Required by XDS interop test harness. RUN python3 -m pip install virtualenv==16.7.9 +# Passwordless sudo for all users +# Bazel docker sandbox and bazel RBE run scripts under docker +# as a regular user, but sometimes we need to be +# able to do something with root privileges. +RUN apt-get update && apt-get install -y sudo && apt-get clean +RUN echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + # Define the default command. CMD ["bash"] diff --git a/tools/run_tests/helper_scripts/build_ruby.sh b/tools/run_tests/helper_scripts/build_ruby.sh index 3b86381786a..cbf7a3cb191 100755 --- a/tools/run_tests/helper_scripts/build_ruby.sh +++ b/tools/run_tests/helper_scripts/build_ruby.sh @@ -45,4 +45,4 @@ popd # unbreak subsequent make builds by restoring zconf.h (previously renamed by cmake build) # see https://github.com/madler/zlib/issues/133 -(cd third_party/zlib; git checkout zconf.h) +(cd third_party/zlib; git checkout zconf.h || cp zconf.h.included zconf.h)