Skip to content

Commit

Permalink
Merge branch 'master' into talent-v4beta1-samples
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhuushmgl authored May 20, 2020
2 parents 489d96c + 21344e0 commit 642aa6c
Show file tree
Hide file tree
Showing 32 changed files with 738 additions and 66 deletions.
18 changes: 9 additions & 9 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @GoogleCloudPlatform/python-samples-owners

/auth/ @busunkim96 @GoogleCloudPlatform/python-samples-owners
/automl/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/automl/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/bigquery/ @shollyman @GoogleCloudPlatform/python-samples-owners
/bigquery_storage/ @shollyman @GoogleCloudPlatform/python-samples-owners
/bigtable/ @GoogleCloudPlatform/bigtable-dpe @GoogleCloudPlatform/python-samples-owners
Expand All @@ -26,7 +26,7 @@
/datalabeling/ @sgreenberg @GoogleCloudPlatform/python-samples-owners
/dataproc/ @bradmiro @GoogleCloudPlatform/python-samples-owners
/datastore/ @GoogleCloudPlatform/firestore-dpe @GoogleCloudPlatform/python-samples-owners
/dialogflow/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/dialogflow/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/dlp/ @GoogleCloudPlatform/python-samples-owners
/dns/ @michaelawyu @GoogleCloudPlatform/python-samples-owners
/endpoints/ @DanSanche @GoogleCloudPlatform/python-samples-owners
Expand All @@ -40,7 +40,7 @@
/jobs/ @GoogleCloudPlatform/python-samples-owners
/kms/ @DanSanche @GoogleCloudPlatform/python-samples-owners
/kubernetes_engine/ @GoogleCloudPlatform/python-samples-owners
/language/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/language/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/logging/ @GoogleCloudPlatform/python-samples-owners
/memorystore/ @GoogleCloudPlatform/python-samples-owners
/ml_engine/ @alecglassford @GoogleCloudPlatform/python-samples-owners
Expand All @@ -52,13 +52,13 @@
/run/ @averikitsch @GoogleCloudPlatform/python-samples-owners
/scheduler/ @averikitsch @GoogleCloudPlatform/python-samples-owners
/spanner/ @mmmarklu @GoogleCloudPlatform/python-samples-owners
/speech/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/speech/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/storage/ @GoogleCloudPlatform/storage-dpe @GoogleCloudPlatform/python-samples-owners
/tables/automl/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/tables/automl/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/tasks/ @averikitsch @GoogleCloudPlatform/python-samples-owners
/texttospeech/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/texttospeech/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/third_party/apache-airflow/ @leahecole @GoogleCloudPlatform/python-samples-owners
/trace/ @dukeng @ziweizhao @GoogleCloudPlatform/python-samples-owners
/translate/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/video/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/vision/ @nnegrey @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/translate/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/video/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
/vision/ @telpirion @sirtorry @GoogleCloudPlatform/python-samples-owners
164 changes: 164 additions & 0 deletions .kokoro/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Copyright 2020 Google LLC
#
# 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.

# Sometimes renovate tries to update it to 16.10. I don't think it's
# worthwhile because 16.04 is an LTS release. Maybe we should think
# about upgrading to 18.04 (the next LTS) instead.
FROM ubuntu:16.04

ENV DEBIAN_FRONTEND noninteractive

# Ensure local Python is preferred over distribution Python.
ENV PATH /usr/local/bin:$PATH

# http://bugs.python.org/issue19846
# At the moment, setting "LANG=C" on a Linux system fundamentally breaks
# Python 3.
ENV LANG C.UTF-8

# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
curl \
git \
graphviz \
libbz2-dev \
libdb5.3-dev \
libexpat1-dev \
libffi-dev \
liblzma-dev \
libmagickwand-dev \
libreadline-dev \
libsnappy-dev \
libssl-dev \
libsqlite3-dev \
portaudio19-dev \
redis-server \
software-properties-common \
ssh \
sudo \
tcl \
tcl-dev \
tk \
tk-dev \
uuid-dev \
wget \
zlib1g-dev \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb

# Install docker
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

RUN add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
docker-ce \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb

# Install Microsoft ODBC 17 Driver and unixodbc for testing SQL Server samples
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y --no-install-recommends \
msodbcsql17 \
unixodbc-dev \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb

# Install the desired versions of Python.
RUN for PYTHON_VERSION in 2.7.17 3.6.9 3.7.5 3.8.0; do \
set -ex \
&& 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" \
&& 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" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
# 2.7.17 (Benjamin Peterson)
C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF \
# 3.4.10, 3.5.9 (Larry Hastings)
97FC712E4C024BBEA48A61ED3A5CA953F73C700D \
# 3.6.9, 3.7.5 (Ned Deily)
0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D \
# 3.8.0 (Łukasz Langa)
E3FF2839C048B25C084DEBE9B26995E310250568 \
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
&& rm -r "$GNUPGHOME" python-${PYTHON_VERSION}.tar.xz.asc \
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
&& rm python-${PYTHON_VERSION}.tar.xz \
&& cd /usr/src/python-${PYTHON_VERSION} \
&& ./configure \
--enable-shared \
# This works only on Python 2.7 and throws a warning on every other
# version, but seems otherwise harmless.
--enable-unicode=ucs4 \
--with-system-ffi \
--without-ensurepip \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
; done \
&& rm -rf /usr/src/python* \
&& rm -rf ~/.cache/


# Install pip on Python 3.6 only.
# If the environment variable is called "PIP_VERSION", pip explodes with
# "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 10.0.1
RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3.6 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
# then we use "pip list" to ensure we don't have more than one pip version installed
# https://github.com/docker-library/python/pull/100
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ]

# Ensure Pip for 3.8.0
RUN python3.8 /tmp/get-pip.py
RUN rm /tmp/get-pip.py

# Install "virtualenv", since the vast majority of users of this image
# will want it.
RUN pip install --no-cache-dir virtualenv

# Setup Cloud SDK
ENV CLOUD_SDK_VERSION 272.0.0
# Use system python for cloud sdk.
ENV CLOUDSDK_PYTHON python3.6
RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz
RUN tar xzf google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz
RUN /google-cloud-sdk/install.sh
ENV PATH /google-cloud-sdk/bin:$PATH

# Enable redis-server on boot.
RUN sudo systemctl enable redis-server.service

CMD ["python3.6"]
24 changes: 24 additions & 0 deletions .kokoro/docker/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2020 Google LLC
#
# 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.

timeout: 7200s # 2 hours

steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/python-samples-testing-docker', '.']
dir: '.kokoro/docker'
- name: gcr.io/cloud-builders/docker
args: ['tag', 'gcr.io/$PROJECT_ID/python-samples-testing-docker', 'gcr.io/$PROJECT_ID/python-samples-testing-docker:$SHORT_SHA']
images:
- 'gcr.io/$PROJECT_ID/python-samples-testing-docker'
2 changes: 1 addition & 1 deletion .kokoro/python2.7/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ timeout_mins: 300
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download trampoline resources.
Expand Down
5 changes: 5 additions & 0 deletions .kokoro/python2.7/periodic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-docs-samples/.kokoro/tests/run_tests.sh"
}

env_vars: {
key: "REPORT_TO_BUILD_COP_BOT"
value: "True"
}
2 changes: 1 addition & 1 deletion .kokoro/python3.6/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ timeout_mins: 300
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download trampoline resources.
Expand Down
5 changes: 5 additions & 0 deletions .kokoro/python3.6/periodic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-docs-samples/.kokoro/tests/run_tests.sh"
}

env_vars: {
key: "REPORT_TO_BUILD_COP_BOT"
value: "True"
}
2 changes: 1 addition & 1 deletion .kokoro/python3.7/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ timeout_mins: 300
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download trampoline resources.
Expand Down
5 changes: 5 additions & 0 deletions .kokoro/python3.7/periodic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-docs-samples/.kokoro/tests/run_tests.sh"
}

env_vars: {
key: "REPORT_TO_BUILD_COP_BOT"
value: "True"
}
2 changes: 1 addition & 1 deletion .kokoro/python3.8/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ timeout_mins: 300
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download trampoline resources.
Expand Down
5 changes: 5 additions & 0 deletions .kokoro/python3.8/periodic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-docs-samples/.kokoro/tests/run_tests.sh"
}

env_vars: {
key: "REPORT_TO_BUILD_COP_BOT"
value: "True"
}
8 changes: 5 additions & 3 deletions .kokoro/tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ for file in **/requirements.txt; do
nox -s "$RUN_TESTS_SESSION"
EXIT=$?

# If this is a periodic build, send the test log to the Build Cop Bot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
# If REPORT_TO_BUILD_COP_BOT is set to "True", send the test log
# to the Build Cop Bot.
# See:
# https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
if [[ "${REPORT_TO_BUILD_COP_BOT:-}" == "True" ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
$KOKORO_GFILE_DIR/linux_amd64/buildcop
fi
Expand Down
2 changes: 1 addition & 1 deletion appengine/standard/mailgun/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
httplib2==0.17.3
httplib2==0.18.0
2 changes: 1 addition & 1 deletion asset/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-cloud-storage==1.28.1
google-cloud-asset==0.10.0
google-cloud-resource-manager==0.30.1
google-cloud-resource-manager==0.30.2
google-cloud-pubsub==1.4.3
Loading

0 comments on commit 642aa6c

Please sign in to comment.