From 8e754f9c2bd4b4ec6561613ff57c095886877960 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 25 May 2016 17:04:38 -0700 Subject: [PATCH] enter_chroot: do not export variables that weren't previously exported COREOS_BUILD_ID is set to a default value in common.sh if unset in the environment. When entering the chroot this default value should not then get promoted into the environment. Doing so causes catalyst to re-use stale builds and multiple build_image runs to conflict with each other. --- sdk_lib/enter_chroot.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index c5ae6053a4..520f8124ae 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -394,7 +394,11 @@ CHROOT_PASSTHRU=( # Add the whitelisted environment variables to CHROOT_PASSTHRU. load_environment_whitelist for var in "${ENVIRONMENT_WHITELIST[@]}" ; do - [ "${!var+set}" = "set" ] && CHROOT_PASSTHRU+=( "${var}=${!var}" ) + # skip empty/unset values + [[ "${!var+set}" == "set" ]] || continue + # skip values that aren't actually exported + [[ $(declare -p "${var}") == "declare -x ${var}="* ]] || continue + CHROOT_PASSTHRU+=( "${var}=${!var}" ) done # Set up GIT_PROXY_COMMAND so git:// URLs automatically work behind a proxy.