Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ffbaf61

Browse filesBrowse files
author
Takashi Matsuo
committed
add TRAMPOLINE_IMAGE_UPLOAD envvar
also cleanup the docs
1 parent f21011a commit ffbaf61
Copy full SHA for ffbaf61

File tree

Expand file treeCollapse file tree

2 files changed

+34
-12
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+34
-12
lines changed

‎.kokoro/trampoline_v2.sh

Copy file name to clipboardExpand all lines: .kokoro/trampoline_v2.sh
+17-12Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@
3636
#
3737
# TRAMPOLINE_IMAGE: The docker image to use.
3838
# TRAMPOLINE_IMAGE_SOURCE: The location of the Dockerfile.
39-
# RUN_TESTS_SESSION: The nox session to run.
39+
# TRAMPOLINE_IMAGE_UPLOAD:
40+
# (true|false): Whether to upload the Docker image after the
41+
# successful builds.
4042
# TRAMPOLINE_BUILD_FILE: The script to run in the docker container.
41-
# RUN_TESTS_DIR: A colon separated directory list relative to the
42-
# project root.
43+
#
44+
# Potentially there are some repo specific envvars in .trampolinerc in
45+
# the project root.
46+
4347

4448
set -euo pipefail
4549

@@ -55,10 +59,12 @@ else
5559
readonly IO_COLOR_RESET=""
5660
fi
5761

58-
# Logs a message using the given color. The first argument must be one of the
59-
# IO_COLOR_* variables defined above, such as "${IO_COLOR_YELLOW}". The
60-
# remaining arguments will be logged in the given color. The log message will
61-
# also have an RFC-3339 timestamp prepended (in UTC).
62+
# Logs a message using the given color. The first argument must be one
63+
# of the IO_COLOR_* variables defined above, such as
64+
# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the
65+
# given color. The log message will also have an RFC-3339 timestamp
66+
# prepended (in UTC). You can disable the color output by setting
67+
# TERM=vt100.
6268
function log_impl() {
6369
local color="$1"
6470
shift
@@ -278,11 +284,10 @@ else
278284
log_red "Build finished with ${test_retval}"
279285
fi
280286

281-
if [[ "${RUNNING_IN_CI}" == "true" ]] && \
282-
[[ "${update_cache}" == "true" ]] && \
283-
[[ -z "${KOKORO_GITHUB_PULL_REQUEST_NUMBER:-}" ]] && \
284-
[[ $test_retval == 0 ]]; then
285-
# Only upload it when the test passes.
287+
# Only upload it when the test passes.
288+
if [[ "${update_cache}" == "true" ]] && \
289+
[[ $test_retval == 0 ]] && \
290+
[[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then
286291
log_yellow "Uploading the Docker image."
287292
if docker push "${TRAMPOLINE_IMAGE}"; then
288293
log_green "Finished uploading the Docker image."

‎.trampolinerc

Copy file name to clipboardExpand all lines: .trampolinerc
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# Environment variables for python-docs-samples:
16+
# RUN_TESTS_SESSION: The nox session to run.
17+
# RUN_TESTS_DIR: A colon separated directory list relative to the
18+
# project root.
19+
1520
required_envvars+=(
1621
# The nox session to run.
1722
"RUN_TESTS_SESSION"
@@ -25,6 +30,14 @@ pass_down_envvars+=(
2530
"RUN_TESTS_SESSION"
2631
)
2732

33+
# Prevent unintentional override on the default image.
34+
35+
if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \
36+
[[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
37+
echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image."
38+
exit 1
39+
fi
40+
2841
# Set default values. You can override them with env vars.
2942
if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
3043
# Set default image.
@@ -42,3 +55,7 @@ fi
4255
if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then
4356
TRAMPOLINE_BUILD_FILE=".kokoro/tests/run_tests_diff_head.sh"
4457
fi
58+
59+
if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then
60+
TRAMPOLINE_IMAGE_UPLOAD="false"
61+
fi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.