[Interop] Test grpc-go 1.64 using go 1.22 runtime (#36755)

Use the latest golang base image for Go interop tests. Presently the latest image points to Go 1.22.
<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

## Commands run
To render the Dockerfile from its template
```sh
$ tools/buildgen/generate_projects.sh
```
To build and upload the base docker image.
```sh
$ tools/dockerfile/push_testing_images.sh
```

To build and upload the interop docker image for grpc-go 1.64.0
```sh
$ tools/interop_matrix/create_matrix_images.py --git_checkout --release=v1.64.0  --upload_images --language go
```

To verify the image is uploaded
```sh
$ gcloud container images list-tags gcr.io/grpc-testing/grpc_interop_go1.x
DIGEST        TAGS                                         TIMESTAMP
b36be4961ec4  infrastructure-public-image-v1.64.0,v1.64.0  2024-06-03T22:26:48
```

Verify the backward compatability tests pass
```sh
$ export docker_image=gcr.io/grpc-testing/grpc_interop_go1.x:v1.64.0
$ tools/interop_matrix/testcases/go__master
Testing gcr.io/grpc-testing/grpc_interop_go1.x:v1.64.0
```

Fixes: https://github.com/grpc/grpc/issues/36060

Closes #36755

PiperOrigin-RevId: 641272572
pull/36849/head
Arjan Singh Bal 6 months ago committed by Copybara-Service
parent 1dbfd4c9f2
commit d038e0ed19
  1. 7
      templates/tools/dockerfile/gcp_api_libraries_venv.include
  2. 23
      templates/tools/dockerfile/interoptest/grpc_interop_go1.x/Dockerfile.template
  3. 3
      templates/tools/dockerfile/interoptest/grpc_interop_go1.x/build_interop.sh.template
  4. 33
      templates/tools/dockerfile/run_tests_python_deps_venv.include
  5. 1
      tools/bazelify_tests/dockerimage_current_versions.bzl
  6. 1
      tools/dockerfile/interoptest/grpc_interop_go1.x.current_version
  7. 58
      tools/dockerfile/interoptest/grpc_interop_go1.x/Dockerfile
  8. 33
      tools/dockerfile/interoptest/grpc_interop_go1.x/build_interop.sh
  9. 3
      tools/interop_matrix/client_matrix.py

@ -0,0 +1,7 @@
# Install Google Cloud Platform API libraries
# These are needed for uploading test results to BigQuery (e.g. by tools/run_tests scripts)
# This template is similar to gcp_api_libraries.include but installs the
# dependencies in a python virtual environment. This is required from pip 23.0
# onwards as installation of system-wide packages is blocked by default.
RUN /bin/bash -c "source $PYTHON_ENV/bin/activate && \
python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-client==1.12.8 oauth2client==4.1.0"

@ -0,0 +1,23 @@
%YAML 1.2
--- |
# Copyright 2024 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 golang:latest
<%include file="../../go_path.include"/>
<%include file="../../run_tests_python_deps_venv.include"/>
# Define the default command.
CMD ["bash"]

@ -0,0 +1,3 @@
%YAML 1.2
--- |
<%include file="../../go_build_interop.sh.include"/>

@ -0,0 +1,33 @@
#====================
# 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)
# This template is similar to run_tests_python_deps.include but installs the
# dependencies in a python virtual environment. This is required from pip 23.0
# onwards as installation of system-wide packages is blocked by default.
RUN apt-get update && apt-get install -y ${'\\'}
python3 ${'\\'}
python3-pip ${'\\'}
python3-setuptools ${'\\'}
python3-yaml ${'\\'}
python3-venv ${'\\'}
&& apt-get clean
# Create a python virtual env for installing required dependencies.
ENV PYTHON_ENV="/opt/venv/grpc-interop"
RUN python3 -m venv "$PYTHON_ENV"
RUN echo "source $PYTHON_ENV/bin/activate" >> ~/.bashrc
# Use bash explicitly as /bin/sh doesn't support the "source" command.
# use pinned version of pip to avoid sudden breakages
# TODO(#36814): currently six is needed for tools/run_tests scripts
# but since our python2 usage is deprecated, we should get rid of it.
RUN /bin/bash -c "source $PYTHON_ENV/bin/activate && \
python3 -m pip install --upgrade pip==19.3.1 && \
python3 -m pip install six==1.16.0 && \
python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-client==1.12.8 oauth2client==4.1.0"
<%include file="./gcp_api_libraries_venv.include"/>

@ -78,6 +78,7 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/interoptest/grpc_interop_go1.16.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_go1.16@sha256:3767f47c9d06584c6c07b7ab536e13f3e87550330e6c2652ad288d3a72b0de23",
"tools/dockerfile/interoptest/grpc_interop_go1.19.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_go1.19@sha256:889e7ff34399a5e16af87940d1eaa239e56da307f7faca3f8f1d28379c2e3df3",
"tools/dockerfile/interoptest/grpc_interop_go1.8.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_go1.8@sha256:7830a301b37539252c592b9cd7fa30a6142d0afc717a05fc8d2b82c74fb45efe",
"tools/dockerfile/interoptest/grpc_interop_go1.x.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_go1.x@sha256:c1d1babd31ea7e635aa68d56803212f9e0091ff628288c18dc86d890f837303a",
"tools/dockerfile/interoptest/grpc_interop_http2.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_http2@sha256:e3f247d8038374848fadf7215b841e3575c0b2a4217feb503a79b8004b164c5a",
"tools/dockerfile/interoptest/grpc_interop_java.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_java@sha256:6c0319bbbf77d6c198f61adf92d205efd33cbd2cccaf914a1af8f2dcb61b16a1",
"tools/dockerfile/interoptest/grpc_interop_node.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_node@sha256:549a7683cc024fb7ffee807eaa8acb6c2d5a5dd0184a2590f91852804eea39a4",

@ -0,0 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_go1.x:9740f2234d8c996def3f0e09791328c39dac0ab1@sha256:c1d1babd31ea7e635aa68d56803212f9e0091ff628288c18dc86d890f837303a

@ -0,0 +1,58 @@
# Copyright 2024 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 golang:latest
# Using login shell removes Go from path, so we add it.
RUN ln -s /usr/local/go/bin/go /usr/local/bin
#====================
# 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)
# This template is similar to run_tests_python_deps.include but installs the
# dependencies in a python virtual environment. This is required from pip 23.0
# onwards as installation of system-wide packages is blocked by default.
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-setuptools \
python3-yaml \
python3-venv \
&& apt-get clean
# Create a python virtual env for installing required dependencies.
ENV PYTHON_ENV="/opt/venv/grpc-interop"
RUN python3 -m venv "$PYTHON_ENV"
RUN echo "source $PYTHON_ENV/bin/activate" >> ~/.bashrc
# Use bash explicitly as /bin/sh doesn't support the "source" command.
# use pinned version of pip to avoid sudden breakages
# TODO(#36814): currently six is needed for tools/run_tests scripts
# but since our python2 usage is deprecated, we should get rid of it.
RUN /bin/bash -c "source $PYTHON_ENV/bin/activate && python3 -m pip install --upgrade pip==19.3.1 && python3 -m pip install six==1.16.0 && python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-client==1.12.8 oauth2client==4.1.0"
# Install Google Cloud Platform API libraries
# These are needed for uploading test results to BigQuery (e.g. by tools/run_tests scripts)
# This template is similar to gcp_api_libraries.include but installs the
# dependencies in a python virtual environment. This is required from pip 23.0
# onwards as installation of system-wide packages is blocked by default.
RUN /bin/bash -c "source $PYTHON_ENV/bin/activate && python3 -m pip install --upgrade google-auth==1.23.0 google-api-python-client==1.12.8 oauth2client==4.1.0"
# Define the default command.
CMD ["bash"]

@ -0,0 +1,33 @@
#!/bin/bash
# Copyright 2015 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.
#
# Builds Go interop server and client in a base image.
set -e
# Turn on support for Go modules.
export GO111MODULE=on
# Clone just the grpc-go source code without any dependencies.
# We are cloning from a local git repo that contains the right revision
# to test instead of using "go get" to download from Github directly.
git clone --recursive /var/local/jenkins/grpc-go src/google.golang.org/grpc
# copy service account keys if available
cp -r /var/local/jenkins/service_account $HOME || true
# Build the interop client and server
(cd src/google.golang.org/grpc/interop/client && go install)
(cd src/google.golang.org/grpc/interop/server && go install)

@ -53,7 +53,7 @@ def should_build_docker_interop_image_from_release_tag(lang):
# Dictionary of default runtimes per language
LANG_RUNTIME_MATRIX = {
"cxx": ["cxx"], # This is actually debian8.
"go": ["go1.8", "go1.11", "go1.16", "go1.19"],
"go": ["go1.x"],
"java": ["java"],
"python": ["python", "pythonasyncio"],
"node": ["node"],
@ -301,6 +301,7 @@ LANG_RELEASE_MATRIX = {
("v1.61.2", ReleaseInfo(runtimes=["go1.19"])),
("v1.62.2", ReleaseInfo(runtimes=["go1.19"])),
("v1.63.2", ReleaseInfo(runtimes=["go1.19"])),
("v1.64.0", ReleaseInfo()),
]
),
"java": OrderedDict(

Loading…
Cancel
Save