Merge "Install docker for tests"

This commit is contained in:
Jenkins 2016-06-29 21:23:40 +00:00 committed by Gerrit Code Review
commit 867bfaa44d
4 changed files with 13 additions and 7 deletions

View File

@ -445,7 +445,7 @@ for X in ${!IMAGE_TYPES[@]} ; do
elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \
--exclude ./proc --xattrs --xattrs-include=\* . \
| docker import - $DOCKER_TARGET
| sudo docker import - $DOCKER_TARGET
unset IMAGE_TYPES[$X]
fi
done

View File

@ -106,7 +106,9 @@ function finalise_base () {
fi
fi
# Cleanup /tmp in the guest, so there is less cruft left there
if [ -d "$TMP_MOUNT_PATH/tmp" ]; then
unmount_dir $TMP_MOUNT_PATH/tmp
fi
find $TMP_MOUNT_PATH/tmp -maxdepth 1 -mindepth 1 | xargs sudo rm -rf --one-file-system
}

View File

@ -4,14 +4,18 @@ set -eux
set -o pipefail
sudo apt-get update || true
sudo apt-get install -y \
sudo apt-get install -y --force-yes \
apt-transport-https \
debootstrap \
docker.io \
inetutils-ping \
lsb-release \
kpartx \
qemu-utils \
uuid-runtime || \
sudo yum -y install \
debootstrap \
docker \
kpartx \
qemu-img || \
sudo emerge \

View File

@ -26,7 +26,7 @@ function build_test_image() {
dest_dir=$(mktemp -d)
base_dest=$(basename $dest_dir)
trap "rm -rf $dest_dir; docker rmi $base_dest/image" EXIT
trap "rm -rf $dest_dir; sudo docker rmi $base_dest/image" EXIT
ELEMENTS_PATH=$DIB_ELEMENTS:$TEST_ELEMENTS \
$DIB_CMD -x $type_arg --docker-target=$base_dest/image \
@ -43,7 +43,7 @@ function build_test_image() {
echo "Found image $img_path."
fi
else
if ! docker images | grep $base_dest/image ; then
if ! sudo docker images | grep $base_dest/image ; then
echo "Error: No docker image with name $base_dest/image found!"
exit 1
else
@ -54,8 +54,8 @@ function build_test_image() {
trap EXIT
rm -rf $dest_dir
if docker images | grep $base_dest/image ; then
docker rmi $base_dest/image
if sudo docker images | grep $base_dest/image ; then
sudo docker rmi $base_dest/image
fi
}