Install docker for tests
We have some test cases which attempt to build docker images, therefore we need docker. Fix a few bugs that showed up when we run docker tests - we need to docker rm with sudo and docker images don't always have a /tmp so check before unmounting it. Change-Id: I147d0ef3f2ea83f35bac568214573a6bde0b1967
This commit is contained in:
parent
11128b0673
commit
edc06a20e5
@ -434,7 +434,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
|
||||
|
@ -121,7 +121,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
|
||||
}
|
||||
|
||||
|
@ -4,13 +4,17 @@ 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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user