From 5467b92c97ba3ae276e65684a05d924910db7eb5 Mon Sep 17 00:00:00 2001 From: Kannan J Date: Thu, 9 Jul 2026 12:43:06 +0000 Subject: [PATCH 1/2] php: Transition PHP interop image and run_tests suite to php8 --- .../grpc_interop_php8/Dockerfile.inja | 23 ++++ .../dockerimage_current_versions.bzl | 3 +- .../grpc_interop_php7.current_version | 2 +- .../grpc_interop_php7/build_interop.sh | 4 - .../grpc_interop_php8.current_version | 1 + .../interoptest/grpc_interop_php8/Dockerfile | 123 ++++++++++++++++++ .../grpc_interop_php8/build_interop.sh | 43 ++++++ .../python_utils/filter_pull_request_tests.py | 2 +- tools/run_tests/run_interop_tests.py | 10 +- .../run_tests/sanity/check_test_filtering.py | 1 + 10 files changed, 200 insertions(+), 12 deletions(-) create mode 100644 templates/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile.inja create mode 100644 tools/dockerfile/interoptest/grpc_interop_php8.current_version create mode 100644 tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile create mode 100644 tools/dockerfile/interoptest/grpc_interop_php8/build_interop.sh diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile.inja b/templates/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile.inja new file mode 100644 index 0000000000000..51f8a9c46d9ab --- /dev/null +++ b/templates/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile.inja @@ -0,0 +1,23 @@ +# 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 debian:12 + +{% include "../../apt_get_basic.include" %} +{% include "../../run_tests_python_deps_pep668.include" %} +{% include "../../php8_deps.include" %} +{% include "../../php_common_deps.include" %} +{% include "../../cmake.include" %} +{% include "../../ccache.include" %} +{% include "../../run_tests_addons.include" %} diff --git a/tools/bazelify_tests/dockerimage_current_versions.bzl b/tools/bazelify_tests/dockerimage_current_versions.bzl index 91a511d7b463c..af0474362b6f2 100644 --- a/tools/bazelify_tests/dockerimage_current_versions.bzl +++ b/tools/bazelify_tests/dockerimage_current_versions.bzl @@ -87,7 +87,8 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/interoptest/grpc_interop_java.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_java@sha256:91ff5d28c2de63eaf6ee121429e7a7b269c83110833a5e2a9a46a2954dcbfb4a", "tools/dockerfile/interoptest/grpc_interop_node.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_node@sha256:c30e8af219aae32f5c682c1027dfceaa489ea412613b151cc351e4c6daa3bb69", "tools/dockerfile/interoptest/grpc_interop_nodepurejs.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_nodepurejs@sha256:b990c14434ed85caede949170c2f917085166874de34410be2452b9447e42371", - "tools/dockerfile/interoptest/grpc_interop_php7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php7@sha256:6cd1cf75b1b2cec360c2e58ac6e5cabbc4ffb3e6403c78cfbfeb40dc500c68e9", + "tools/dockerfile/interoptest/grpc_interop_php7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php7:e60f5c2d1683cfb78934c1305d138fc4f3555a18@", + "tools/dockerfile/interoptest/grpc_interop_php8.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php8:3741277163be6f9f3822d11317b558419d0224ed@", "tools/dockerfile/interoptest/grpc_interop_python.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_python@sha256:5759a1299c2c3b20119be2be4da3865eb67d8c1e41bc233a0dd54122a312eaae", "tools/dockerfile/interoptest/grpc_interop_pythonasyncio.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_pythonasyncio@sha256:9c11f1e1debbc616a65a9e7027d0e9ab4a4374442620e6f24c3ad92a316841a6", "tools/dockerfile/interoptest/grpc_interop_ruby.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby@sha256:ec7161bdc8bb835b41e7b655398651685eaf87978de409995f4eb5479d286cac", diff --git a/tools/dockerfile/interoptest/grpc_interop_php7.current_version b/tools/dockerfile/interoptest/grpc_interop_php7.current_version index f764b6278bff9..a7aa197920ace 100644 --- a/tools/dockerfile/interoptest/grpc_interop_php7.current_version +++ b/tools/dockerfile/interoptest/grpc_interop_php7.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php7:2c85c9be0f09c45bf0e51a7f729389f949f08ed1@sha256:6cd1cf75b1b2cec360c2e58ac6e5cabbc4ffb3e6403c78cfbfeb40dc500c68e9 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php7:e60f5c2d1683cfb78934c1305d138fc4f3555a18@ \ No newline at end of file diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh index 0d10728597ad6..0ef722d8ee530 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh @@ -41,10 +41,6 @@ popd cd src/php -# Configure Composer to not block insecure/vulnerable packages (needed because of -# older firebase/php-jwt in dependencies on PHP 7.4) -php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer config audit.block-insecure false || true - DONE=0 for ((i = 0; i < 5; i++)); do php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer install && DONE=1 && break diff --git a/tools/dockerfile/interoptest/grpc_interop_php8.current_version b/tools/dockerfile/interoptest/grpc_interop_php8.current_version new file mode 100644 index 0000000000000..8ac32c35944dc --- /dev/null +++ b/tools/dockerfile/interoptest/grpc_interop_php8.current_version @@ -0,0 +1 @@ +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_php8:3741277163be6f9f3822d11317b558419d0224ed@ \ No newline at end of file diff --git a/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile new file mode 100644 index 0000000000000..26733988973d7 --- /dev/null +++ b/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile @@ -0,0 +1,123 @@ +# 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 debian:12 + +#================= +# 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 + +#================= +# Setup git to access working directory across docker boundary. +# This avoids the "fatal: detected dubious ownership in repository XYZ" +# git error. + +RUN git config --global --add safe.directory '*' +RUN git config --global protocol.file.allow always + + +#==================== +# 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 +# Some newer distros that have already implemented PEP 668. Use of +# --break-system-packages is to workaround that. We should look into using +# virtualenv in Dockerfile though. +RUN python3 -m pip install --break-system-packages --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 + + +#================= +# PHP8 dependencies + +RUN apt-get update && apt-get install -y php8.2 php8.2-dev php-pear && apt-get clean + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php +RUN mv composer.phar /usr/local/bin/composer + +#================= +# 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 --fail --retry 5 -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.11.3/ccache-4.11.3.tar.gz \ + && tar -zxf ccache.tar.gz \ + && cd ccache-4.11.3 \ + && 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.11.3 ccache.tar.gz + + +RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/interoptest/grpc_interop_php8/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php8/build_interop.sh new file mode 100644 index 0000000000000..8ea3322513a82 --- /dev/null +++ b/tools/dockerfile/interoptest/grpc_interop_php8/build_interop.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# 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. + +set -ex + +# cd to gRPC root +cd "$(dirname "$0")/../../.." +grpc_root="$(pwd)" + +# Install gRPC C core +make -j4 shared_c static_c + +# Build gRPC PHP native extension +pushd src/php/ext/grpc +phpize +GRPC_LIB_SUBDIR=libs/opt ./configure --enable-grpc="${grpc_root}" +make -j4 +popd + +cd src/php + +DONE=0 +for ((i = 0; i < 5; i++)); do + php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer install && DONE=1 && break +done + +if [ "$DONE" != "1" ] +then + echo "Failed to do composer install" + exit 1 +fi diff --git a/tools/run_tests/python_utils/filter_pull_request_tests.py b/tools/run_tests/python_utils/filter_pull_request_tests.py index 75cf0b7e194f4..66e433d67b8e2 100644 --- a/tools/run_tests/python_utils/filter_pull_request_tests.py +++ b/tools/run_tests/python_utils/filter_pull_request_tests.py @@ -45,7 +45,7 @@ def add_trigger(self, trigger): _CSHARP_TEST_SUITE = TestSuite(["csharp"]) _NODE_TEST_SUITE = TestSuite(["grpc-node"]) _OBJC_TEST_SUITE = TestSuite(["objc"]) -_PHP_TEST_SUITE = TestSuite(["php", "php7"]) +_PHP_TEST_SUITE = TestSuite(["php", "php7", "php8"]) _PYTHON_TEST_SUITE = TestSuite(["python"]) _RUBY_TEST_SUITE = TestSuite(["ruby"]) _LINUX_TEST_SUITE = TestSuite(["linux"]) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index ae7b8448ba84a..257ca0c1f06e0 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -439,7 +439,7 @@ def __str__(self): return "nodepurejs" -class PHP7Language: +class PHP8Language: def __init__(self): self.client_cwd = None self.server_cwd = None @@ -470,7 +470,7 @@ def unimplemented_test_cases_server(self): return _SKIP_COMPRESSION + _ORCA_TEST_CASES def __str__(self): - return "php7" + return "php8" class ObjcLanguage: @@ -694,7 +694,7 @@ def __str__(self): "javaokhttp": JavaOkHttpClient(), "node": NodeLanguage(), "nodepurejs": NodePureJSLanguage(), - "php7": PHP7Language(), + "php8": PHP8Language(), "objc": ObjcLanguage(), "ruby": RubyLanguage(), "python": PythonLanguage(), @@ -712,7 +712,7 @@ def __str__(self): "python", "dart", "pythonasyncio", - "php7", + "php8", ] _TEST_CASES = [ @@ -886,7 +886,7 @@ def auth_options( if language in [ "aspnetcore", "node", - "php7", + "php8", "python", "ruby", "nodepurejs", diff --git a/tools/run_tests/sanity/check_test_filtering.py b/tools/run_tests/sanity/check_test_filtering.py index 5ceb4fa50199e..be3472b4c4fd6 100755 --- a/tools/run_tests/sanity/check_test_filtering.py +++ b/tools/run_tests/sanity/check_test_filtering.py @@ -33,6 +33,7 @@ "objc", "php", "php7", + "php8", "python", "ruby", ] From 16a53bb2f7f4c58c22d2e8dfcf79363f5ceccd29 Mon Sep 17 00:00:00 2001 From: kannanjgithub <29600796+kannanjgithub@users.noreply.github.com> Date: Thu, 9 Jul 2026 12:54:28 +0000 Subject: [PATCH 2/2] Automated change: Fix sanity tests --- tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile index 26733988973d7..60d2121747e86 100644 --- a/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_php8/Dockerfile @@ -121,3 +121,4 @@ RUN curl -sSL --fail --retry 5 -o ccache.tar.gz https://github.com/ccache/ccache RUN mkdir /var/local/jenkins +