From 1289cdae2e65d40db77c456919b2d44f80f3c228 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 27 Jan 2022 06:45:52 +0100 Subject: [PATCH] Upgrade PHP docker images to debian11 (#28701) * upgrade PHP docker images to debian11 * regenerate dockerfiles * adjust testrunners to php debian11 images --- .../grpc_interop_php7/Dockerfile.template | 6 ++-- .../Dockerfile.template | 6 +++- .../Dockerfile.template | 4 ++- .../interoptest/grpc_interop_php7/Dockerfile | 28 ++++++++++++++++--- .../Dockerfile | 24 +++++++++++++++- .../Dockerfile | 22 ++++++++++++++- tools/internal_ci/linux/grpc_xds_php.sh | 2 +- tools/internal_ci/linux/grpc_xds_v3_php.sh | 2 +- tools/run_tests/artifacts/artifact_targets.py | 2 +- tools/run_tests/run_tests.py | 2 +- 10 files changed, 84 insertions(+), 14 deletions(-) rename templates/tools/dockerfile/test/{php73_zts_stretch_x64 => php73_zts_debian11_x64}/Dockerfile.template (88%) rename templates/tools/dockerfile/test/{php7_stretch_x64 => php7_debian11_x64}/Dockerfile.template (90%) rename tools/dockerfile/test/{php73_zts_stretch_x64 => php73_zts_debian11_x64}/Dockerfile (70%) rename tools/dockerfile/test/{php7_stretch_x64 => php7_debian11_x64}/Dockerfile (78%) diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template index 8e8dbdc25fc..5758667926e 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template @@ -14,10 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM debian:stretch + FROM debian:11 <%include file="../../apt_get_basic.include"/> <%include file="../../run_tests_python_deps.include"/> <%include file="../../php7_deps.include"/> - <%include file="../../run_tests_addons.include"/> <%include file="../../php_common_deps.include"/> + <%include file="../../cmake.include"/> + <%include file="../../ccache.include"/> + <%include file="../../run_tests_addons.include"/> diff --git a/templates/tools/dockerfile/test/php73_zts_stretch_x64/Dockerfile.template b/templates/tools/dockerfile/test/php73_zts_debian11_x64/Dockerfile.template similarity index 88% rename from templates/tools/dockerfile/test/php73_zts_stretch_x64/Dockerfile.template rename to templates/tools/dockerfile/test/php73_zts_debian11_x64/Dockerfile.template index 0b79815eb42..81728fc7420 100644 --- a/templates/tools/dockerfile/test/php73_zts_stretch_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/php73_zts_debian11_x64/Dockerfile.template @@ -14,7 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM php:7.3-zts-stretch + # debian 11 = "bullseye" + FROM php:7.3-zts-bullseye RUN apt-get update && apt-get install -y ${'\\'} autoconf automake build-essential git libtool curl ${'\\'} @@ -34,8 +35,11 @@ <%include file="../../run_tests_python_deps.include"/> <%include file="../../php_common_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. diff --git a/templates/tools/dockerfile/test/php7_stretch_x64/Dockerfile.template b/templates/tools/dockerfile/test/php7_debian11_x64/Dockerfile.template similarity index 90% rename from templates/tools/dockerfile/test/php7_stretch_x64/Dockerfile.template rename to templates/tools/dockerfile/test/php7_debian11_x64/Dockerfile.template index d57db995eef..74e16519751 100644 --- a/templates/tools/dockerfile/test/php7_stretch_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/php7_debian11_x64/Dockerfile.template @@ -14,12 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM debian:stretch + FROM 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/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile index 138ec6c9681..5628cb83199 100644 --- a/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM debian:stretch +FROM debian:11 #================= # Basic C core dependencies @@ -107,10 +107,30 @@ RUN cd /var/local/git/php-src \ && make -j$(nproc) \ && make install - -RUN mkdir /var/local/jenkins - # 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 -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 + diff --git a/tools/dockerfile/test/php73_zts_stretch_x64/Dockerfile b/tools/dockerfile/test/php73_zts_debian11_x64/Dockerfile similarity index 70% rename from tools/dockerfile/test/php73_zts_stretch_x64/Dockerfile rename to tools/dockerfile/test/php73_zts_debian11_x64/Dockerfile index a71e413d5f3..f157b24d0a7 100644 --- a/tools/dockerfile/test/php73_zts_stretch_x64/Dockerfile +++ b/tools/dockerfile/test/php73_zts_debian11_x64/Dockerfile @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM php:7.3-zts-stretch +# debian 11 = "bullseye" +FROM php:7.3-zts-bullseye RUN apt-get update && apt-get install -y \ autoconf automake build-essential git libtool curl \ @@ -59,10 +60,31 @@ RUN python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-clien 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 -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. diff --git a/tools/dockerfile/test/php7_stretch_x64/Dockerfile b/tools/dockerfile/test/php7_debian11_x64/Dockerfile similarity index 78% rename from tools/dockerfile/test/php7_stretch_x64/Dockerfile rename to tools/dockerfile/test/php7_debian11_x64/Dockerfile index d03b6b06ae4..d3871eb4f91 100644 --- a/tools/dockerfile/test/php7_stretch_x64/Dockerfile +++ b/tools/dockerfile/test/php7_debian11_x64/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM debian:stretch +FROM debian:11 #================= # Basic C core dependencies @@ -112,6 +112,26 @@ RUN cd /var/local/git/php-src \ 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 diff --git a/tools/internal_ci/linux/grpc_xds_php.sh b/tools/internal_ci/linux/grpc_xds_php.sh index 8b643430ea3..543eeff5d1f 100755 --- a/tools/internal_ci/linux/grpc_xds_php.sh +++ b/tools/internal_ci/linux/grpc_xds_php.sh @@ -20,7 +20,7 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc -export DOCKERFILE_DIR=tools/dockerfile/test/php73_zts_stretch_x64 +export DOCKERFILE_DIR=tools/dockerfile/test/php73_zts_debian11_x64 export DOCKER_RUN_SCRIPT=tools/internal_ci/linux/grpc_xds_php_test_in_docker.sh export OUTPUT_DIR=reports exec tools/run_tests/dockerize/build_and_run_docker.sh diff --git a/tools/internal_ci/linux/grpc_xds_v3_php.sh b/tools/internal_ci/linux/grpc_xds_v3_php.sh index eebbc285266..760baf5056a 100755 --- a/tools/internal_ci/linux/grpc_xds_v3_php.sh +++ b/tools/internal_ci/linux/grpc_xds_v3_php.sh @@ -20,7 +20,7 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc -export DOCKERFILE_DIR=tools/dockerfile/test/php73_zts_stretch_x64 +export DOCKERFILE_DIR=tools/dockerfile/test/php73_zts_debian11_x64 export DOCKER_RUN_SCRIPT=tools/internal_ci/linux/grpc_xds_v3_php_test_in_docker.sh export OUTPUT_DIR=reports exec tools/run_tests/dockerize/build_and_run_docker.sh diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index d86f484eca6..1894196b7c6 100644 --- a/tools/run_tests/artifacts/artifact_targets.py +++ b/tools/run_tests/artifacts/artifact_targets.py @@ -315,7 +315,7 @@ class PHPArtifact: if self.platform == 'linux': return create_docker_jobspec( self.name, - 'tools/dockerfile/test/php73_zts_stretch_{}'.format(self.arch), + 'tools/dockerfile/test/php73_zts_debian11_{}'.format(self.arch), 'tools/run_tests/artifacts/build_artifact_php.sh') else: return create_jobspec( diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index e74fdab463d..9edda392cc5 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -588,7 +588,7 @@ class Php7Language(object): return 'Makefile' def dockerfile_dir(self): - return 'tools/dockerfile/test/php7_stretch_%s' % _docker_arch_suffix( + return 'tools/dockerfile/test/php7_debian11_%s' % _docker_arch_suffix( self.args.arch) def __str__(self):