Merge pull request #18372 from Microsoft/jjh/winci-ensurefrozen

Windows CI Fix: No subshell due to bash 3.x
This commit is contained in:
Jess Frazelle 2015-12-14 10:32:53 -08:00
commit b13fd10109
1 changed files with 8 additions and 2 deletions

View File

@ -36,7 +36,10 @@ esac
if ! docker inspect "${images[@]}" &> /dev/null; then if ! docker inspect "${images[@]}" &> /dev/null; then
hardCodedDir='/docker-frozen-images' hardCodedDir='/docker-frozen-images'
if [ -d "$hardCodedDir" ]; then if [ -d "$hardCodedDir" ]; then
( set -x; tar -cC "$hardCodedDir" . | docker load ) # Do not use a subshell for the following command. Windows CI
# runs bash 3.x so will not trap an error in a subshell.
# http://stackoverflow.com/questions/22630363/how-does-set-e-work-with-subshells
set -x; tar -cC "$hardCodedDir" . | docker load; set +x
else else
dir="$DEST/frozen-images" dir="$DEST/frozen-images"
# extract the exact "RUN download-frozen-image-v2.sh" line from the Dockerfile itself for consistency # extract the exact "RUN download-frozen-image-v2.sh" line from the Dockerfile itself for consistency
@ -58,7 +61,10 @@ if ! docker inspect "${images[@]}" &> /dev/null; then
} }
} }
' ${DOCKER_FILE:="Dockerfile"} | sh -x ' ${DOCKER_FILE:="Dockerfile"} | sh -x
( set -x; tar -cC "$dir" . | docker load ) # Do not use a subshell for the following command. Windows CI
# runs bash 3.x so will not trap an error in a subshell.
# http://stackoverflow.com/questions/22630363/how-does-set-e-work-with-subshells
set -x; tar -cC "$dir" . | docker load; set +x
fi fi
fi fi