Skip to content

Commit 4bcf945

Browse files
clintharrisonk8s-ci-robot
authored andcommitted
Fix incremental loader cleanup when no run statements are defined (#875)
1 parent cd7ddbe commit 4bcf945

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

container/incremental_load.sh.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ function read_variables() {
239239
%{tag_statements}
240240

241241
# An optional "docker run" statement for invoking a loaded container.
242-
# This is not executed if the single argument --norun is passed.
243-
if [ "a$*" != "a--norun" ]; then
242+
# This is not executed if the single argument --norun is passed or
243+
# no run_statements are generated (in which case, 'run' is 'False').
244+
if [[ "a$*" != "a--norun" && "%{run}" == "True" ]]; then
244245
# Once we've loaded the images for all layers, we no longer need the temporary files on disk.
245246
# We can clean up before we exec docker, since the exit handler will no longer run.
246247
cleanup

container/layer_tools.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def incremental_load(
219219
"%{docker_tool_path}": toolchain_info.tool_path,
220220
"%{load_statements}": "\n".join(load_statements),
221221
"%{run_statements}": "\n".join(run_statements),
222+
"%{run}": str(run),
222223
# If this rule involves stamp variables than load them as bash
223224
# variables, and turn references to them into bash variable
224225
# references.

0 commit comments

Comments
 (0)