36
36
#
37
37
# TRAMPOLINE_IMAGE: The docker image to use.
38
38
# 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.
40
42
# 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
+
43
47
44
48
set -euo pipefail
45
49
55
59
readonly IO_COLOR_RESET=" "
56
60
fi
57
61
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.
62
68
function log_impl() {
63
69
local color=" $1 "
64
70
shift
@@ -278,11 +284,10 @@ else
278
284
log_red " Build finished with ${test_retval} "
279
285
fi
280
286
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
286
291
log_yellow " Uploading the Docker image."
287
292
if docker push " ${TRAMPOLINE_IMAGE} " ; then
288
293
log_green " Finished uploading the Docker image."
0 commit comments