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 elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \ sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \
--exclude ./proc --xattrs --xattrs-include=\* . \ --exclude ./proc --xattrs --xattrs-include=\* . \
| docker import - $DOCKER_TARGET | sudo docker import - $DOCKER_TARGET
unset IMAGE_TYPES[$X] unset IMAGE_TYPES[$X]
fi fi
done done

View File

@ -106,7 +106,9 @@ function finalise_base () {
fi fi
fi fi
# Cleanup /tmp in the guest, so there is less cruft left there # 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 unmount_dir $TMP_MOUNT_PATH/tmp
fi
find $TMP_MOUNT_PATH/tmp -maxdepth 1 -mindepth 1 | xargs sudo rm -rf --one-file-system 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 set -o pipefail
sudo apt-get update || true sudo apt-get update || true
sudo apt-get install -y \ sudo apt-get install -y --force-yes \
apt-transport-https \
debootstrap \ debootstrap \
docker.io \
inetutils-ping \ inetutils-ping \
lsb-release \
kpartx \ kpartx \
qemu-utils \ qemu-utils \
uuid-runtime || \ uuid-runtime || \
sudo yum -y install \ sudo yum -y install \
debootstrap \ debootstrap \
docker \
kpartx \ kpartx \
qemu-img || \ qemu-img || \
sudo emerge \ sudo emerge \

View File

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