Moved cirros image to /var/snap/microstack/common/images

This way, it will get cleaned up when we uninstall the snap.

Also added test hooks to test upgrades, to verify that we aren't
breaking existing snaps.
This commit is contained in:
Pete Vander Giessen 2019-04-18 10:21:06 -04:00
parent c1efa221f8
commit 6e13cc4112
2 changed files with 29 additions and 5 deletions

12
snap/hooks/configure vendored
View File

@ -50,14 +50,16 @@ sleep 5
# Wait for identity service # Wait for identity service
while ! nc -z 10.20.20.1 5000; do sleep 0.1; done; while ! nc -z 10.20.20.1 5000; do sleep 0.1; done;
# Setup the cirros image, which is used by the launch app
openstack image show cirros || { openstack image show cirros || {
[ -f $HOME/images/cirros-0.3.5-x86_64-disk.img ] || { [ -f $SNAP_COMMON/images/cirros-0.4.0-x86_64-disk.img ] || {
mkdir -p $HOME/images mkdir -p $SNAP_COMMON/images
wget \ wget \
http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img \ http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img \
-O ${HOME}/images/cirros-0.3.5-x86_64-disk.img -O ${SNAP_COMMON}/images/cirros-0.4.0-x86_64-disk.img
} }
openstack image create --file ${HOME}/images/cirros-0.3.5-x86_64-disk.img \ openstack image create \
--file ${SNAP_COMMON}/images/cirros-0.4.0-x86_64-disk.img \
--public --container-format=bare --disk-format=qcow2 cirros --public --container-format=bare --disk-format=qcow2 cirros
} }

View File

@ -2,6 +2,20 @@
set -ex set -ex
# Command line args.
# Pass -u edge/candidate/stable to install
# microstack from the matching channel in the snap store before
# installing the locally built snap. This will help verify that we
# aren't breaking snaps in the wild with a change.
UPGRADE_FROM="none"
while getopts u: option
do
case "${option}"
in
u) UPGRADE_FROM=${OPTARG};;
esac
done
# Dependencies. TODO: move these into a testing harness # Dependencies. TODO: move these into a testing harness
command -v multipass > /dev/null || (echo "Please install multipass."; exit 1); command -v multipass > /dev/null || (echo "Please install multipass."; exit 1);
command -v petname > /dev/null || (echo "Please install petname."; exit 1); command -v petname > /dev/null || (echo "Please install petname."; exit 1);
@ -17,6 +31,14 @@ DISTRO=18.04
# Launch a machine and copy the snap to it. # Launch a machine and copy the snap to it.
multipass launch --cpus 2 --mem 16G $DISTRO --name $MACHINE multipass launch --cpus 2 --mem 16G $DISTRO --name $MACHINE
multipass copy-files microstack_rocky_amd64.snap $MACHINE: multipass copy-files microstack_rocky_amd64.snap $MACHINE:
# Possibly install a release of the snap before running a test.
if [ "${UPGRADE_FROM}" != "none" ]; then
multipass exec $MACHINE -- sudo snap install --classic \
--${UPGRADE_FROM} microstack
fi
# Install the snap under test
multipass exec $MACHINE -- \ multipass exec $MACHINE -- \
sudo snap install --classic --dangerous microstack*.snap sudo snap install --classic --dangerous microstack*.snap