Skip to content

Commit fc365b8

Browse files
build: use trampoline_v2 for python samples and allow custom dockerfile (#1552)
1 parent 01f479f commit fc365b8

File tree

14 files changed

+74
-14
lines changed

14 files changed

+74
-14
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docker:
22
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
3-
digest: sha256:82b12321da4446a73cb11bcb6812fbec8c105abda3946d46e6394e5fbfb64c0f
3+
digest: sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc

.kokoro/samples/lint/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
3131
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
3232

3333
# Use the trampoline script to run in docker.
34-
build_file: "google-api-python-client/.kokoro/trampoline.sh"
34+
build_file: "google-api-python-client/.kokoro/trampoline_v2.sh"

.kokoro/samples/python3.6/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
3737
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
3838

3939
# Use the trampoline script to run in docker.
40-
build_file: "google-api-python-client/.kokoro/trampoline.sh"
40+
build_file: "google-api-python-client/.kokoro/trampoline_v2.sh"

.kokoro/samples/python3.6/periodic.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
env_vars: {
44
key: "INSTALL_LIBRARY_FROM_SOURCE"
55
value: "False"
6-
}
6+
}

.kokoro/samples/python3.7/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
3737
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
3838

3939
# Use the trampoline script to run in docker.
40-
build_file: "google-api-python-client/.kokoro/trampoline.sh"
40+
build_file: "google-api-python-client/.kokoro/trampoline_v2.sh"

.kokoro/samples/python3.7/periodic.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
env_vars: {
44
key: "INSTALL_LIBRARY_FROM_SOURCE"
55
value: "False"
6-
}
6+
}

.kokoro/samples/python3.8/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
3737
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
3838

3939
# Use the trampoline script to run in docker.
40-
build_file: "google-api-python-client/.kokoro/trampoline.sh"
40+
build_file: "google-api-python-client/.kokoro/trampoline_v2.sh"

.kokoro/samples/python3.8/periodic.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
env_vars: {
44
key: "INSTALL_LIBRARY_FROM_SOURCE"
55
value: "False"
6-
}
6+
}

.kokoro/samples/python3.9/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
3737
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
3838

3939
# Use the trampoline script to run in docker.
40-
build_file: "google-api-python-client/.kokoro/trampoline.sh"
40+
build_file: "google-api-python-client/.kokoro/trampoline_v2.sh"

.kokoro/samples/python3.9/periodic.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
env_vars: {
44
key: "INSTALL_LIBRARY_FROM_SOURCE"
55
value: "False"
6-
}
6+
}

.kokoro/test-samples-against-head.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@ set -eo pipefail
2323
# Enables `**` to include files nested inside sub-folders
2424
shopt -s globstar
2525

26-
cd github/google-api-python-client
27-
2826
exec .kokoro/test-samples-impl.sh

.kokoro/test-samples.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ set -eo pipefail
2424
# Enables `**` to include files nested inside sub-folders
2525
shopt -s globstar
2626

27-
cd github/google-api-python-client
28-
2927
# Run periodic samples tests at latest release
3028
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
3129
# preserving the test runner implementation.

.trampolinerc

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Template for .trampolinerc
16+
17+
# Add required env vars here.
18+
required_envvars+=(
19+
)
20+
21+
# Add env vars which are passed down into the container here.
22+
pass_down_envvars+=(
23+
"NOX_SESSION"
24+
###############
25+
# Docs builds
26+
###############
27+
"STAGING_BUCKET"
28+
"V2_STAGING_BUCKET"
29+
##################
30+
# Samples builds
31+
##################
32+
"INSTALL_LIBRARY_FROM_SOURCE"
33+
"RUN_TESTS_SESSION"
34+
"BUILD_SPECIFIC_GCLOUD_PROJECT"
35+
# Target directories.
36+
"RUN_TESTS_DIRS"
37+
# The nox session to run.
38+
"RUN_TESTS_SESSION"
39+
)
40+
41+
# Prevent unintentional override on the default image.
42+
if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \
43+
[[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
44+
echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image."
45+
exit 1
46+
fi
47+
48+
# Define the default value if it makes sense.
49+
if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then
50+
TRAMPOLINE_IMAGE_UPLOAD=""
51+
fi
52+
53+
if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
54+
TRAMPOLINE_IMAGE=""
55+
fi
56+
57+
if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then
58+
TRAMPOLINE_DOCKERFILE=""
59+
fi
60+
61+
if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then
62+
TRAMPOLINE_BUILD_FILE=""
63+
fi

owlbot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# Copy kokoro configs.
2828
# Docs are excluded as repo docs cannot currently be generated using sphinx.
2929
s.move(templated_files / '.kokoro', excludes=['**/docs/*', 'publish-docs.sh'])
30+
s.move(templated_files / '.trampolinerc') # config file for trampoline_v2
3031

3132
# Also move issue templates
3233
s.move(templated_files / '.github')

0 commit comments

Comments
 (0)