From 6d3c45ff7b758a686fe4343d26e1c426cd14b22b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 14 Mar 2022 13:30:52 +0100 Subject: [PATCH] Add dockerized ARM64 tests (bazel C/C++, C#, PHP, ruby, python) (#28966) * C# arm64 docker image * add ruby arm64 docker image * add bazel_arm64 docker image * add python arm64 image * add php arm64 docker image * regenerate * add support for running arm64 tests with run_tests.py * restrict arm64 testing to python3.9 * first version of bazel arm64 C++ tests * add arm64 job configs * add initial checks to push_testing_images.sh --- templates/tools/dockerfile/bazel.include | 17 ++- .../dockerfile/csharp_dotnetcli_deps.include | 8 +- .../test/bazel_arm64/Dockerfile.template | 27 ++++ .../csharp_debian11_arm64/Dockerfile.template | 28 ++++ .../php7_debian11_arm64/Dockerfile.template | 27 ++++ .../Dockerfile.template | 31 ++++ .../ruby_debian11_arm64/Dockerfile.template | 30 ++++ .../grpc_interop_csharp/Dockerfile | 8 +- .../grpc_interop_csharpcoreclr/Dockerfile | 8 +- tools/dockerfile/push_testing_images.sh | 13 ++ tools/dockerfile/test/bazel/Dockerfile | 17 ++- tools/dockerfile/test/bazel_arm64/Dockerfile | 112 ++++++++++++++ .../test/binder_transport_apk/Dockerfile | 17 ++- .../test/csharp_debian11_arm64/Dockerfile | 143 ++++++++++++++++++ .../test/csharp_debian11_x64/Dockerfile | 8 +- .../test/php7_debian11_arm64/Dockerfile | 137 +++++++++++++++++ .../python_debian11_default_arm64/Dockerfile | 90 +++++++++++ .../test/ruby_debian11_arm64/Dockerfile | 126 +++++++++++++++ tools/dockerfile/test/sanity/Dockerfile | 17 ++- .../linux/arm64/grpc_basictests_csharp.cfg | 30 ++++ .../linux/arm64/grpc_basictests_php.cfg | 30 ++++ .../linux/arm64/grpc_basictests_python.cfg | 30 ++++ .../linux/arm64/grpc_basictests_ruby.cfg | 30 ++++ tools/internal_ci/linux/arm64/grpc_bazel.sh | 25 +++ .../linux/arm64/grpc_bazel_test_c_cpp.cfg | 23 +++ .../arm64/grpc_bazel_test_c_cpp_in_docker.sh | 29 ++++ tools/run_tests/run_tests.py | 18 ++- tools/run_tests/run_tests_matrix.py | 34 +++++ 28 files changed, 1085 insertions(+), 28 deletions(-) create mode 100644 templates/tools/dockerfile/test/bazel_arm64/Dockerfile.template create mode 100644 templates/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile.template create mode 100644 templates/tools/dockerfile/test/php7_debian11_arm64/Dockerfile.template create mode 100644 templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template create mode 100644 templates/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile.template create mode 100644 tools/dockerfile/test/bazel_arm64/Dockerfile create mode 100644 tools/dockerfile/test/csharp_debian11_arm64/Dockerfile create mode 100644 tools/dockerfile/test/php7_debian11_arm64/Dockerfile create mode 100644 tools/dockerfile/test/python_debian11_default_arm64/Dockerfile create mode 100644 tools/dockerfile/test/ruby_debian11_arm64/Dockerfile create mode 100644 tools/internal_ci/linux/arm64/grpc_basictests_csharp.cfg create mode 100644 tools/internal_ci/linux/arm64/grpc_basictests_php.cfg create mode 100644 tools/internal_ci/linux/arm64/grpc_basictests_python.cfg create mode 100644 tools/internal_ci/linux/arm64/grpc_basictests_ruby.cfg create mode 100755 tools/internal_ci/linux/arm64/grpc_bazel.sh create mode 100644 tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp.cfg create mode 100755 tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp_in_docker.sh diff --git a/templates/tools/dockerfile/bazel.include b/templates/tools/dockerfile/bazel.include index c0338ab5d24..e9e48a7ec2d 100644 --- a/templates/tools/dockerfile/bazel.include +++ b/templates/tools/dockerfile/bazel.include @@ -7,7 +7,16 @@ ENV BAZEL_VERSION 4.2.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 -RUN apt-get update && apt-get install -y wget && apt-get clean -RUN wget "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" && ${'\\'} - bash ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && ${'\\'} - rm bazel-$BAZEL_VERSION-installer-linux-x86_64.sh +# Download the correct bazel version and make sure it's on path. +RUN BAZEL_ARCH_SUFFIX="$(uname -m | sed s/aarch64/arm64/)" ${'\\'} + && curl -sSL --fail -o /usr/local/bin/bazel "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-$BAZEL_ARCH_SUFFIX" ${'\\'} + && chmod a+x /usr/local/bin/bazel + +# Normally we would run "bazel --version" here to make sure bazel +# was correctly installed, but we can't do that because +# of # https://github.com/bazelbuild/bazel/issues/11379. +# We want to keep the arm64 version of the image buildable +# on x64 with use of qemu-user-static & binfmt emulation, +# but the self-extraction is broken for bazel currently. +# The binary will work correctly when run on real arm64 +# hardware, when qemu-user-static isn't getting into the way. diff --git a/templates/tools/dockerfile/csharp_dotnetcli_deps.include b/templates/tools/dockerfile/csharp_dotnetcli_deps.include index 31f20e662de..e0f20c49e25 100644 --- a/templates/tools/dockerfile/csharp_dotnetcli_deps.include +++ b/templates/tools/dockerfile/csharp_dotnetcli_deps.include @@ -1,11 +1,15 @@ # Install .NET Core 3.1 (to be able to run the netcoreapp3.1 targets) -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.415/dotnet-sdk-3.1.415-linux-x64.tar.gz ${'\\'} +RUN DOTNET_DOWNLOAD_VERSION=3.1.415 ${'\\'} + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" ${'\\'} + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz ${'\\'} && mkdir -p /usr/share/dotnet ${'\\'} && tar -zxf dotnet.tar.gz -C /usr/share/dotnet ${'\\'} && rm dotnet.tar.gz # Install .NET 6 -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-x64.tar.gz ${'\\'} +RUN DOTNET_DOWNLOAD_VERSION=6.0.100 ${'\\'} + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" ${'\\'} + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz ${'\\'} && mkdir -p /usr/share/dotnet ${'\\'} && tar -zxf dotnet.tar.gz -C /usr/share/dotnet ${'\\'} && rm dotnet.tar.gz diff --git a/templates/tools/dockerfile/test/bazel_arm64/Dockerfile.template b/templates/tools/dockerfile/test/bazel_arm64/Dockerfile.template new file mode 100644 index 00000000000..46720abdca1 --- /dev/null +++ b/templates/tools/dockerfile/test/bazel_arm64/Dockerfile.template @@ -0,0 +1,27 @@ +%YAML 1.2 +--- | + # Copyright 2022 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. + + FROM arm64v8/debian:11 + + <%include file="../../apt_get_basic.include"/> + <%include file="../../run_tests_python_deps.include"/> + <%include file="../../cxx_deps.include"/> + + # Install bazel + <%include file="../../bazel.include"/> + + # Define the default command. + CMD ["bash"] diff --git a/templates/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile.template b/templates/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile.template new file mode 100644 index 00000000000..8783bd07ac7 --- /dev/null +++ b/templates/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile.template @@ -0,0 +1,28 @@ +%YAML 1.2 +--- | + # Copyright 2022 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. + + FROM arm64v8/debian:11 + + <%include file="../../apt_get_basic.include"/> + <%include file="../../run_tests_python_deps.include"/> + <%include file="../../csharp_deps.include"/> + <%include file="../../csharp_dotnetcli_deps.include"/> + <%include file="../../ccache.include"/> + <%include file="../../run_tests_addons.include"/> + + # Define the default command. + CMD ["bash"] + diff --git a/templates/tools/dockerfile/test/php7_debian11_arm64/Dockerfile.template b/templates/tools/dockerfile/test/php7_debian11_arm64/Dockerfile.template new file mode 100644 index 00000000000..5c87f782db0 --- /dev/null +++ b/templates/tools/dockerfile/test/php7_debian11_arm64/Dockerfile.template @@ -0,0 +1,27 @@ +%YAML 1.2 +--- | + # Copyright 2016 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. + + FROM arm64v8/debian:11 + + <%include file="../../apt_get_basic.include"/> + <%include file="../../run_tests_python_deps.include"/> + <%include file="../../php7_deps.include"/> + <%include file="../../php_valgrind.include"/> + <%include file="../../cmake.include"/> + <%include file="../../ccache.include"/> + <%include file="../../run_tests_addons.include"/> + # Define the default command. + CMD ["bash"] diff --git a/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template b/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template new file mode 100644 index 00000000000..ca6873105b7 --- /dev/null +++ b/templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template @@ -0,0 +1,31 @@ +%YAML 1.2 +--- | + # Copyright 2022 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. + + FROM arm64v8/debian:11 + + <%include file="../../apt_get_basic.include"/> + <%include file="../../run_tests_addons.include"/> + + # 3.9 is the default python3 version on debian11 + 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 + + <%include file="../../gcp_api_libraries.include"/> + + <%include file="../../cmake.include"/> + <%include file="../../ccache.include"/> diff --git a/templates/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile.template b/templates/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile.template new file mode 100644 index 00000000000..86bb2a4c472 --- /dev/null +++ b/templates/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile.template @@ -0,0 +1,30 @@ +%YAML 1.2 +--- | + # Copyright 2022 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. + + FROM arm64v8/debian:11 + + <%include file="../../apt_get_basic.include"/> + <%include file="../../run_tests_python_deps.include"/> + <%include file="../../ruby_deps.include"/> + <%include file="../../cmake.include"/> + <%include file="../../ccache.include"/> + <%include file="../../run_tests_addons.include"/> + + # Seems required by XDS interop tests. + RUN python3 -m pip install virtualenv==16.7.9 + + # Define the default command. + CMD ["bash"] diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile index 684ca698c6a..1d3cc5012ee 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile @@ -95,13 +95,17 @@ RUN apt-get update && apt-get install -y \ && apt-get clean # Install .NET Core 3.1 (to be able to run the netcoreapp3.1 targets) -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.415/dotnet-sdk-3.1.415-linux-x64.tar.gz \ +RUN DOTNET_DOWNLOAD_VERSION=3.1.415 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz # Install .NET 6 -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-x64.tar.gz \ +RUN DOTNET_DOWNLOAD_VERSION=6.0.100 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile index 684ca698c6a..1d3cc5012ee 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile @@ -95,13 +95,17 @@ RUN apt-get update && apt-get install -y \ && apt-get clean # Install .NET Core 3.1 (to be able to run the netcoreapp3.1 targets) -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.415/dotnet-sdk-3.1.415-linux-x64.tar.gz \ +RUN DOTNET_DOWNLOAD_VERSION=3.1.415 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz # Install .NET 6 -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-x64.tar.gz \ +RUN DOTNET_DOWNLOAD_VERSION=6.0.100 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz diff --git a/tools/dockerfile/push_testing_images.sh b/tools/dockerfile/push_testing_images.sh index 3c9ad50dd6f..e10337cce42 100755 --- a/tools/dockerfile/push_testing_images.sh +++ b/tools/dockerfile/push_testing_images.sh @@ -27,6 +27,19 @@ cd $(dirname $0)/../.. git_root=$(pwd) cd - +# Check that docker is installed and sudoless docker works. +docker run -it debian:11 bash -c 'echo "sudoless docker run works!"' || \ + (echo "Error: docker not installed or sudoless docker doesn't work?" && exit 1) + +# Some of the images we build are for arm64 architecture and the easiest +# way of allowing them to build locally on x64 machine is to use +# qemu binfmt-misc hook that automatically runs arm64 binaries under +# an emulator. +# Perform a check that "qemu-user-static" with binfmt-misc hook +# is installed, to give an early warning (otherwise building arm64 images won't work) +docker run -it arm64v8/debian:11 bash -c 'echo "able to run arm64 docker images with an emulator!"' || \ + (echo "Error: can't run arm64 images under an emulator. Have you run 'sudo apt-get install qemu-user-static'?" && exit 1) + DOCKERHUB_ORGANIZATION=grpctesting for DOCKERFILE_DIR in tools/dockerfile/test/* tools/dockerfile/grpc_artifact_* tools/dockerfile/interoptest/* tools/dockerfile/distribtest/* third_party/rake-compiler-dock/*/ diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index e42f47da682..4600d0b27c3 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -43,10 +43,19 @@ ENV BAZEL_VERSION 4.2.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 -RUN apt-get update && apt-get install -y wget && apt-get clean -RUN wget "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" && \ - bash ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ - rm bazel-$BAZEL_VERSION-installer-linux-x86_64.sh +# Download the correct bazel version and make sure it's on path. +RUN BAZEL_ARCH_SUFFIX="$(uname -m | sed s/aarch64/arm64/)" \ + && curl -sSL --fail -o /usr/local/bin/bazel "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-$BAZEL_ARCH_SUFFIX" \ + && chmod a+x /usr/local/bin/bazel + +# Normally we would run "bazel --version" here to make sure bazel +# was correctly installed, but we can't do that because +# of # https://github.com/bazelbuild/bazel/issues/11379. +# We want to keep the arm64 version of the image buildable +# on x64 with use of qemu-user-static & binfmt emulation, +# but the self-extraction is broken for bazel currently. +# The binary will work correctly when run on real arm64 +# hardware, when qemu-user-static isn't getting into the way. RUN mkdir -p /var/local/jenkins diff --git a/tools/dockerfile/test/bazel_arm64/Dockerfile b/tools/dockerfile/test/bazel_arm64/Dockerfile new file mode 100644 index 00000000000..e8137ab72cc --- /dev/null +++ b/tools/dockerfile/test/bazel_arm64/Dockerfile @@ -0,0 +1,112 @@ +# Copyright 2022 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. + +FROM arm64v8/debian:11 + +#================= +# Basic C core dependencies + +# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md +RUN apt-get update && apt-get install -y \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + && apt-get clean + +# GCC +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + && apt-get clean + +# libc6 +RUN apt-get update && apt-get install -y \ + libc6 \ + libc6-dbg \ + libc6-dev \ + && apt-get clean + +# Tools +RUN apt-get update && apt-get install -y \ + bzip2 \ + curl \ + dnsutils \ + git \ + lcov \ + make \ + strace \ + time \ + unzip \ + wget \ + zip \ + && apt-get clean + +#==================== +# run_tests.py python dependencies + +# Basic python dependencies to be able to run tools/run_tests python scripts +# These dependencies are not sufficient to build gRPC Python, gRPC Python +# deps are defined elsewhere (e.g. python_deps.include) +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + python3-setuptools \ + python3-yaml \ + && apt-get clean + +# use pinned version of pip to avoid sudden breakages +RUN python3 -m pip install --upgrade pip==19.3.1 + +# TODO(jtattermusch): currently six is needed for tools/run_tests scripts +# but since our python2 usage is deprecated, we should get rid of it. +RUN python3 -m pip install six==1.16.0 + +# 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 + + +#================= +# C++ dependencies +RUN apt-get update && apt-get -y install libc++-dev clang && apt-get clean + + +# Install bazel +#======================== +# Bazel installation + +# Must be in sync with tools/bazel +ENV BAZEL_VERSION 4.2.1 + +# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. +ENV DISABLE_BAZEL_WRAPPER 1 + +# Download the correct bazel version and make sure it's on path. +RUN BAZEL_ARCH_SUFFIX="$(uname -m | sed s/aarch64/arm64/)" \ + && curl -sSL --fail -o /usr/local/bin/bazel "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-$BAZEL_ARCH_SUFFIX" \ + && chmod a+x /usr/local/bin/bazel + +# Normally we would run "bazel --version" here to make sure bazel +# was correctly installed, but we can't do that because +# of # https://github.com/bazelbuild/bazel/issues/11379. +# We want to keep the arm64 version of the image buildable +# on x64 with use of qemu-user-static & binfmt emulation, +# but the self-extraction is broken for bazel currently. +# The binary will work correctly when run on real arm64 +# hardware, when qemu-user-static isn't getting into the way. + + +# Define the default command. +CMD ["bash"] diff --git a/tools/dockerfile/test/binder_transport_apk/Dockerfile b/tools/dockerfile/test/binder_transport_apk/Dockerfile index 83e4735f33d..10e624cee3b 100644 --- a/tools/dockerfile/test/binder_transport_apk/Dockerfile +++ b/tools/dockerfile/test/binder_transport_apk/Dockerfile @@ -43,10 +43,19 @@ ENV BAZEL_VERSION 4.2.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 -RUN apt-get update && apt-get install -y wget && apt-get clean -RUN wget "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" && \ - bash ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ - rm bazel-$BAZEL_VERSION-installer-linux-x86_64.sh +# Download the correct bazel version and make sure it's on path. +RUN BAZEL_ARCH_SUFFIX="$(uname -m | sed s/aarch64/arm64/)" \ + && curl -sSL --fail -o /usr/local/bin/bazel "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-$BAZEL_ARCH_SUFFIX" \ + && chmod a+x /usr/local/bin/bazel + +# Normally we would run "bazel --version" here to make sure bazel +# was correctly installed, but we can't do that because +# of # https://github.com/bazelbuild/bazel/issues/11379. +# We want to keep the arm64 version of the image buildable +# on x64 with use of qemu-user-static & binfmt emulation, +# but the self-extraction is broken for bazel currently. +# The binary will work correctly when run on real arm64 +# hardware, when qemu-user-static isn't getting into the way. #======================== diff --git a/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile b/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile new file mode 100644 index 00000000000..0fba8e1d8cb --- /dev/null +++ b/tools/dockerfile/test/csharp_debian11_arm64/Dockerfile @@ -0,0 +1,143 @@ +# Copyright 2022 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. + +FROM arm64v8/debian:11 + +#================= +# Basic C core dependencies + +# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md +RUN apt-get update && apt-get install -y \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + && apt-get clean + +# GCC +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + && apt-get clean + +# libc6 +RUN apt-get update && apt-get install -y \ + libc6 \ + libc6-dbg \ + libc6-dev \ + && apt-get clean + +# Tools +RUN apt-get update && apt-get install -y \ + bzip2 \ + curl \ + dnsutils \ + git \ + lcov \ + make \ + strace \ + time \ + unzip \ + wget \ + zip \ + && apt-get clean + +#==================== +# run_tests.py python dependencies + +# Basic python dependencies to be able to run tools/run_tests python scripts +# These dependencies are not sufficient to build gRPC Python, gRPC Python +# deps are defined elsewhere (e.g. python_deps.include) +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + python3-setuptools \ + python3-yaml \ + && apt-get clean + +# use pinned version of pip to avoid sudden breakages +RUN python3 -m pip install --upgrade pip==19.3.1 + +# TODO(jtattermusch): currently six is needed for tools/run_tests scripts +# but since our python2 usage is deprecated, we should get rid of it. +RUN python3 -m pip install six==1.16.0 + +# 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 + + +#================ +# C# dependencies + +# cmake >=3.6 needed to build grpc_csharp_ext +RUN apt-get update && apt-get install -y cmake && apt-get clean + +# Install mono +RUN apt-get update && apt-get install -y apt-transport-https dirmngr && apt-get clean +RUN apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list +RUN apt-get update && apt-get install -y \ + mono-devel \ + ca-certificates-mono \ + nuget \ + && apt-get clean + +# Install .NET Core 3.1 (to be able to run the netcoreapp3.1 targets) +RUN DOTNET_DOWNLOAD_VERSION=3.1.415 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ + && mkdir -p /usr/share/dotnet \ + && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ + && rm dotnet.tar.gz + +# Install .NET 6 +RUN DOTNET_DOWNLOAD_VERSION=6.0.100 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ + && mkdir -p /usr/share/dotnet \ + && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ + && rm dotnet.tar.gz + +# Make sure "dotnet" is on PATH +RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + +# Trigger the population of the local package cache +ENV NUGET_XMLDOC_MODE skip +RUN mkdir warmup \ + && cd warmup \ + && dotnet new \ + && cd .. \ + && rm -rf warmup + +#================= +# Install ccache + +# Install ccache from source since ccache 3.x packaged with most linux distributions +# does not support Redis backend for caching. +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ + && tar -zxf ccache.tar.gz \ + && cd ccache-4.5.1 \ + && mkdir build && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ + && make -j4 && make install \ + && cd ../.. \ + && rm -rf ccache-4.5.1 ccache.tar.gz + + +RUN mkdir /var/local/jenkins + + +# Define the default command. +CMD ["bash"] diff --git a/tools/dockerfile/test/csharp_debian11_x64/Dockerfile b/tools/dockerfile/test/csharp_debian11_x64/Dockerfile index ebfdbec485a..fe730e19c77 100644 --- a/tools/dockerfile/test/csharp_debian11_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_debian11_x64/Dockerfile @@ -95,13 +95,17 @@ RUN apt-get update && apt-get install -y \ && apt-get clean # Install .NET Core 3.1 (to be able to run the netcoreapp3.1 targets) -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.415/dotnet-sdk-3.1.415-linux-x64.tar.gz \ +RUN DOTNET_DOWNLOAD_VERSION=3.1.415 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz # Install .NET 6 -RUN curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.100/dotnet-sdk-6.0.100-linux-x64.tar.gz \ +RUN DOTNET_DOWNLOAD_VERSION=6.0.100 \ + && DOTNET_DOWNLOAD_ARCH="$(uname -m | sed s/x86_64/x64/ | sed s/aarch64/arm64/)" \ + && curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_DOWNLOAD_VERSION/dotnet-sdk-$DOTNET_DOWNLOAD_VERSION-linux-$DOTNET_DOWNLOAD_ARCH.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz diff --git a/tools/dockerfile/test/php7_debian11_arm64/Dockerfile b/tools/dockerfile/test/php7_debian11_arm64/Dockerfile new file mode 100644 index 00000000000..9b8f5a2b81e --- /dev/null +++ b/tools/dockerfile/test/php7_debian11_arm64/Dockerfile @@ -0,0 +1,137 @@ +# Copyright 2016 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. + +FROM arm64v8/debian:11 + +#================= +# Basic C core dependencies + +# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md +RUN apt-get update && apt-get install -y \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + && apt-get clean + +# GCC +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + && apt-get clean + +# libc6 +RUN apt-get update && apt-get install -y \ + libc6 \ + libc6-dbg \ + libc6-dev \ + && apt-get clean + +# Tools +RUN apt-get update && apt-get install -y \ + bzip2 \ + curl \ + dnsutils \ + git \ + lcov \ + make \ + strace \ + time \ + unzip \ + wget \ + zip \ + && apt-get clean + +#==================== +# run_tests.py python dependencies + +# Basic python dependencies to be able to run tools/run_tests python scripts +# These dependencies are not sufficient to build gRPC Python, gRPC Python +# deps are defined elsewhere (e.g. python_deps.include) +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + python3-setuptools \ + python3-yaml \ + && apt-get clean + +# use pinned version of pip to avoid sudden breakages +RUN python3 -m pip install --upgrade pip==19.3.1 + +# TODO(jtattermusch): currently six is needed for tools/run_tests scripts +# but since our python2 usage is deprecated, we should get rid of it. +RUN python3 -m pip install six==1.16.0 + +# 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 + + +#================= +# PHP7 dependencies + +# PHP specific dependencies +RUN apt-get update && apt-get install -y \ + libbison-dev \ + libcurl4-openssl-dev \ + libgmp-dev \ + libgmp3-dev \ + libssl-dev \ + libxml2-dev \ + re2c \ + zlib1g-dev \ + && apt-get clean + +# Compile PHP7 from source +RUN git clone https://github.com/php/php-src /var/local/git/php-src +RUN cd /var/local/git/php-src \ + && git checkout PHP-7.2.34 \ + && ./buildconf --force \ + && ./configure \ + --with-gmp \ + --with-openssl \ + --with-zlib \ + && make -j$(nproc) \ + && make install + +#================= +# PHP Test dependencies + + RUN apt-get update && apt-get install -y \ + valgrind +#================= +# Install cmake +# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement. + +RUN apt-get update && apt-get install -y cmake && apt-get clean + +#================= +# Install ccache + +# Install ccache from source since ccache 3.x packaged with most linux distributions +# does not support Redis backend for caching. +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ + && tar -zxf ccache.tar.gz \ + && cd ccache-4.5.1 \ + && mkdir build && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ + && make -j4 && make install \ + && cd ../.. \ + && rm -rf ccache-4.5.1 ccache.tar.gz + + +RUN mkdir /var/local/jenkins + +# Define the default command. +CMD ["bash"] diff --git a/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile b/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile new file mode 100644 index 00000000000..977de6aa994 --- /dev/null +++ b/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile @@ -0,0 +1,90 @@ +# Copyright 2022 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. + +FROM arm64v8/debian:11 + +#================= +# Basic C core dependencies + +# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md +RUN apt-get update && apt-get install -y \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + && apt-get clean + +# GCC +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + && apt-get clean + +# libc6 +RUN apt-get update && apt-get install -y \ + libc6 \ + libc6-dbg \ + libc6-dev \ + && apt-get clean + +# Tools +RUN apt-get update && apt-get install -y \ + bzip2 \ + curl \ + dnsutils \ + git \ + lcov \ + make \ + strace \ + time \ + unzip \ + wget \ + zip \ + && apt-get clean + + +RUN mkdir /var/local/jenkins + + +# 3.9 is the default python3 version on debian11 +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 + +# 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 + + +#================= +# Install cmake +# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement. + +RUN apt-get update && apt-get install -y cmake && apt-get clean + +#================= +# Install ccache + +# Install ccache from source since ccache 3.x packaged with most linux distributions +# does not support Redis backend for caching. +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ + && tar -zxf ccache.tar.gz \ + && cd ccache-4.5.1 \ + && mkdir build && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ + && make -j4 && make install \ + && cd ../.. \ + && rm -rf ccache-4.5.1 ccache.tar.gz + diff --git a/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile b/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile new file mode 100644 index 00000000000..279bf7d19a5 --- /dev/null +++ b/tools/dockerfile/test/ruby_debian11_arm64/Dockerfile @@ -0,0 +1,126 @@ +# Copyright 2022 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. + +FROM arm64v8/debian:11 + +#================= +# Basic C core dependencies + +# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md +RUN apt-get update && apt-get install -y \ + build-essential \ + autoconf \ + libtool \ + pkg-config \ + && apt-get clean + +# GCC +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + && apt-get clean + +# libc6 +RUN apt-get update && apt-get install -y \ + libc6 \ + libc6-dbg \ + libc6-dev \ + && apt-get clean + +# Tools +RUN apt-get update && apt-get install -y \ + bzip2 \ + curl \ + dnsutils \ + git \ + lcov \ + make \ + strace \ + time \ + unzip \ + wget \ + zip \ + && apt-get clean + +#==================== +# run_tests.py python dependencies + +# Basic python dependencies to be able to run tools/run_tests python scripts +# These dependencies are not sufficient to build gRPC Python, gRPC Python +# deps are defined elsewhere (e.g. python_deps.include) +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + python3-setuptools \ + python3-yaml \ + && apt-get clean + +# use pinned version of pip to avoid sudden breakages +RUN python3 -m pip install --upgrade pip==19.3.1 + +# TODO(jtattermusch): currently six is needed for tools/run_tests scripts +# but since our python2 usage is deprecated, we should get rid of it. +RUN python3 -m pip install six==1.16.0 + +# 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 + + +#================== +# Ruby dependencies + +# Install rvm +RUN apt-get update && apt-get install -y gnupg2 && apt-get clean +RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB +RUN \curl -sSL https://get.rvm.io | bash -s stable + +# Install Ruby 2.5 +RUN apt-get update && apt-get install -y procps && apt-get clean +RUN /bin/bash -l -c "rvm install ruby-2.5" +RUN /bin/bash -l -c "rvm use --default ruby-2.5" +RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" +RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" +RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.5' >> ~/.bashrc" +RUN /bin/bash -l -c "gem install bundler --no-document -v 1.9" + +#================= +# Install cmake +# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement. + +RUN apt-get update && apt-get install -y cmake && apt-get clean + +#================= +# Install ccache + +# Install ccache from source since ccache 3.x packaged with most linux distributions +# does not support Redis backend for caching. +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ + && tar -zxf ccache.tar.gz \ + && cd ccache-4.5.1 \ + && mkdir build && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ + && make -j4 && make install \ + && cd ../.. \ + && rm -rf ccache-4.5.1 ccache.tar.gz + + +RUN mkdir /var/local/jenkins + + +# Seems required by XDS interop tests. +RUN python3 -m pip install virtualenv==16.7.9 + +# Define the default command. +CMD ["bash"] diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index dd441bfc706..e129bf00528 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -108,10 +108,19 @@ ENV BAZEL_VERSION 4.2.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 -RUN apt-get update && apt-get install -y wget && apt-get clean -RUN wget "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" && \ - bash ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ - rm bazel-$BAZEL_VERSION-installer-linux-x86_64.sh +# Download the correct bazel version and make sure it's on path. +RUN BAZEL_ARCH_SUFFIX="$(uname -m | sed s/aarch64/arm64/)" \ + && curl -sSL --fail -o /usr/local/bin/bazel "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-$BAZEL_ARCH_SUFFIX" \ + && chmod a+x /usr/local/bin/bazel + +# Normally we would run "bazel --version" here to make sure bazel +# was correctly installed, but we can't do that because +# of # https://github.com/bazelbuild/bazel/issues/11379. +# We want to keep the arm64 version of the image buildable +# on x64 with use of qemu-user-static & binfmt emulation, +# but the self-extraction is broken for bazel currently. +# The binary will work correctly when run on real arm64 +# hardware, when qemu-user-static isn't getting into the way. # Install buildifier v0.29.0 RUN wget https://github.com/bazelbuild/buildtools/releases/download/0.29.0/buildifier diff --git a/tools/internal_ci/linux/arm64/grpc_basictests_csharp.cfg b/tools/internal_ci/linux/arm64/grpc_basictests_csharp.cfg new file mode 100644 index 00000000000..dfd3e27c966 --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_basictests_csharp.cfg @@ -0,0 +1,30 @@ +# Copyright 2022 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 60 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests_arm64 linux csharp --inner_jobs 4 -j 1 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/linux/arm64/grpc_basictests_php.cfg b/tools/internal_ci/linux/arm64/grpc_basictests_php.cfg new file mode 100644 index 00000000000..cda33bc6d64 --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_basictests_php.cfg @@ -0,0 +1,30 @@ +# Copyright 2022 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 60 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests_arm64 linux php7 --inner_jobs 16 -j 2 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/linux/arm64/grpc_basictests_python.cfg b/tools/internal_ci/linux/arm64/grpc_basictests_python.cfg new file mode 100644 index 00000000000..f3038d8fa1c --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_basictests_python.cfg @@ -0,0 +1,30 @@ +# Copyright 2022 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 60 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests_arm64 linux python --inner_jobs 16 -j 2 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/linux/arm64/grpc_basictests_ruby.cfg b/tools/internal_ci/linux/arm64/grpc_basictests_ruby.cfg new file mode 100644 index 00000000000..4b6c9d28d8a --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_basictests_ruby.cfg @@ -0,0 +1,30 @@ +# Copyright 2022 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_run_tests_matrix.sh" +timeout_mins: 60 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests_arm64 linux ruby --inner_jobs 16 -j 2 --internal_ci --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/linux/arm64/grpc_bazel.sh b/tools/internal_ci/linux/arm64/grpc_bazel.sh new file mode 100755 index 00000000000..0503692aea0 --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_bazel.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Copyright 2022 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. + +set -ex + +# change to grpc repo root +cd $(dirname $0)/../../../.. + +source tools/internal_ci/helper_scripts/prepare_build_linux_rc + +export DOCKERFILE_DIR=tools/dockerfile/test/bazel_arm64 +export DOCKER_RUN_SCRIPT=$BAZEL_SCRIPT +exec tools/run_tests/dockerize/build_and_run_docker.sh diff --git a/tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp.cfg b/tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp.cfg new file mode 100644 index 00000000000..38308432826 --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp.cfg @@ -0,0 +1,23 @@ +# Copyright 2017 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. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/arm64/grpc_bazel.sh" +timeout_mins: 120 +env_vars { + key: "BAZEL_SCRIPT" + value: "tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp_in_docker.sh" +} diff --git a/tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp_in_docker.sh b/tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp_in_docker.sh new file mode 100755 index 00000000000..f2fe8a7206c --- /dev/null +++ b/tools/internal_ci/linux/arm64/grpc_bazel_test_c_cpp_in_docker.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Copyright 2022 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. + +set -ex + +mkdir -p /var/local/git +git clone /var/local/jenkins/grpc /var/local/git/grpc +(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc \ +&& git submodule update --init --reference /var/local/jenkins/grpc/${name} \ +${name}') +cd /var/local/git/grpc + +# tests require port server to be running +python3 tools/run_tests/start_port_server.py + +# test gRPC C/C++ with bazel +tools/bazel test --config=opt --test_output=errors --test_tag_filters=-no_linux,-no_arm64 --build_tag_filters=-no_linux,-no_arm64 --flaky_test_attempts=1 --runs_per_test=1 //test/... diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0d7c5e44f41..3666defaa1d 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -291,7 +291,7 @@ class CLanguage(object): if self.platform == 'linux': # Allow all the known architectures. _check_arch_option has already checked that we're not doing # something illegal when not running under docker. - _check_arch(self.args.arch, ['default', 'x64', 'x86']) + _check_arch(self.args.arch, ['default', 'x64', 'x86', 'arm64']) else: _check_arch(self.args.arch, ['default']) @@ -774,6 +774,11 @@ class PythonLanguage(object): # MacOS, so we restrict the number of interpreter versions # tested. return (python38_config,) + elif platform.machine() == 'aarch64': + # Currently the python_debian11_default_arm64 docker image + # only has python3.9 installed (and that seems sufficient + # for arm64 testing) + return (python39_config,) else: return ( python36_config, @@ -1234,12 +1239,15 @@ def _check_arch_option(arch): _windows_arch_option(arch) elif platform_string() == 'linux': # On linux, we need to be running under docker with the right architecture. + runtime_machine = platform.machine() runtime_arch = platform.architecture()[0] if arch == 'default': return - elif runtime_arch == '64bit' and arch == 'x64': + elif runtime_machine == 'x86_64' and runtime_arch == '64bit' and arch == 'x64': return - elif runtime_arch == '32bit' and arch == 'x86': + elif runtime_machine == 'x86_64' and runtime_arch == '32bit' and arch == 'x86': + return + elif runtime_machine == 'aarch64' and runtime_arch == '64bit' and arch == 'arm64': return else: print( @@ -1259,6 +1267,8 @@ def _docker_arch_suffix(arch): return 'x64' elif arch == 'x86': return 'x86' + elif arch == 'arm64': + return 'arm64' else: print('Architecture %s not supported with current settings.' % arch) sys.exit(1) @@ -1549,7 +1559,7 @@ argp.add_argument( ) argp.add_argument( '--arch', - choices=['default', 'x86', 'x64'], + choices=['default', 'x86', 'x64', 'arm64'], default='default', help= 'Selects architecture to target. For some platforms "default" is the only supported choice.' diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index bde61d4e397..f3e357a26a5 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -210,6 +210,17 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): ['--report_multi_target'], inner_jobs=inner_jobs) + # ARM64 Linux C# tests + test_jobs += _generate_jobs(languages=['csharp'], + configs=['dbg', 'opt'], + platforms=['linux'], + arch='arm64', + compiler='default', + labels=['basictests_arm64'], + extra_args=extra_args + + ['--report_multi_target'], + inner_jobs=inner_jobs) + test_jobs += _generate_jobs(languages=['python'], configs=['opt'], platforms=['linux', 'macos', 'windows'], @@ -219,6 +230,18 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): ['--report_multi_target'], inner_jobs=inner_jobs) + # ARM64 Linux Python tests + test_jobs += _generate_jobs(languages=['python'], + configs=['opt'], + platforms=['linux'], + arch='arm64', + compiler='default', + iomgr_platforms=['native'], + labels=['basictests_arm64'], + extra_args=extra_args + + ['--report_multi_target'], + inner_jobs=inner_jobs) + # supported on linux and mac. test_jobs += _generate_jobs( languages=['c++'], @@ -238,6 +261,17 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS): ['--report_multi_target'], inner_jobs=inner_jobs) + # ARM64 Linux Ruby and PHP tests + test_jobs += _generate_jobs(languages=['ruby', 'php7'], + configs=['dbg', 'opt'], + platforms=['linux'], + arch='arm64', + compiler='default', + labels=['basictests_arm64'], + extra_args=extra_args + + ['--report_multi_target'], + inner_jobs=inner_jobs) + # supported on mac only. test_jobs += _generate_jobs(languages=['objc'], configs=['opt'],