Skip to content

Commit e44dc0c

Browse files
authored
build(python): remove python 3.7 from kokoro Dockerfile (#1155)
A lot of python repositories have a failing `Kokoro docs-presubmit` check with error `gpg: keyserver receive failed: No name`. For example, googleapis/python-asset#227 The issue is that the `fetch_gpg_keys.sh` script is failing in the Docker file [here](https://github.com/googleapis/synthtool/blob/master/synthtool/gcp/templates/python_library/.kokoro/docker/docs/Dockerfile#L68) because the key [here](https://github.com/googleapis/synthtool/blob/master/synthtool/gcp/templates/python_library/.kokoro/docker/docs/fetch_gpg_keys.sh#L39) is no longer available on the keyserver. This PR removes `fetch_gpg_keys.sh` as, in most repositories, we don't need to install additional python versions. We can use the default python version in the ubuntu 20.04 base image which is python 3.8.10.
1 parent 53ea389 commit e44dc0c

File tree

3 files changed

+3
-79
lines changed

3 files changed

+3
-79
lines changed

synthtool/gcp/templates/python_library/.kokoro/docker/docs/Dockerfile

+2-33
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN apt-get update \
4040
libssl-dev \
4141
libsqlite3-dev \
4242
portaudio19-dev \
43+
python3-distutils \
4344
redis-server \
4445
software-properties-common \
4546
ssh \
@@ -59,40 +60,8 @@ RUN apt-get update \
5960
&& rm -rf /var/lib/apt/lists/* \
6061
&& rm -f /var/cache/apt/archives/*.deb
6162

62-
63-
COPY fetch_gpg_keys.sh /tmp
64-
# Install the desired versions of Python.
65-
RUN set -ex \
66-
&& export GNUPGHOME="$(mktemp -d)" \
67-
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
68-
&& /tmp/fetch_gpg_keys.sh \
69-
&& for PYTHON_VERSION in 3.7.8 3.8.5; do \
70-
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
71-
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
72-
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
73-
&& rm -r python-${PYTHON_VERSION}.tar.xz.asc \
74-
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
75-
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
76-
&& rm python-${PYTHON_VERSION}.tar.xz \
77-
&& cd /usr/src/python-${PYTHON_VERSION} \
78-
&& ./configure \
79-
--enable-shared \
80-
# This works only on Python 2.7 and throws a warning on every other
81-
# version, but seems otherwise harmless.
82-
--enable-unicode=ucs4 \
83-
--with-system-ffi \
84-
--without-ensurepip \
85-
&& make -j$(nproc) \
86-
&& make install \
87-
&& ldconfig \
88-
; done \
89-
&& rm -rf "${GNUPGHOME}" \
90-
&& rm -rf /usr/src/python* \
91-
&& rm -rf ~/.cache/
92-
9363
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
94-
&& python3.7 /tmp/get-pip.py \
9564
&& python3.8 /tmp/get-pip.py \
9665
&& rm /tmp/get-pip.py
9766

98-
CMD ["python3.7"]
67+
CMD ["python3.8"]

synthtool/gcp/templates/python_library/.kokoro/docker/docs/fetch_gpg_keys.sh

-45
This file was deleted.

tests/test_python_library.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_python_library():
108108
templated_files = common.py_library()
109109

110110
assert os.path.exists(templated_files / ".kokoro/docs/docs-presubmit.cfg")
111-
assert os.path.exists(templated_files / ".kokoro/docker/docs/fetch_gpg_keys.sh")
111+
assert os.path.exists(templated_files / ".kokoro/docker/docs/Dockerfile")
112112

113113

114114
def test_split_system_tests():

0 commit comments

Comments
 (0)