ci: run tests using kata snap

build, install and test kata containers snap package.

Depends-on: github.com/kata-containers/tests#1454

fixes #428

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2019-04-08 12:05:27 -05:00
parent 1d603643e3
commit 58b799bf9d
2 changed files with 40 additions and 13 deletions

View File

@ -18,8 +18,3 @@ pushd "${tests_repo_dir}"
popd popd
# This script will execute packaging tests suite # This script will execute packaging tests suite
if [ "$ID" == ubuntu ]; then
echo "Building snap image"
make snap
fi

View File

@ -11,16 +11,10 @@ set -o pipefail
source /etc/os-release source /etc/os-release
SNAP_CI="${SNAP_CI:-false}"
echo "Setup script for packaging" echo "Setup script for packaging"
if [ "$ID" == ubuntu ]; then
echo "Install snap dependencies"
sudo apt-get install -y snapd snapcraft
echo "Install kernel dependencies"
sudo -E apt install -y libelf-dev bc gcc
fi
export tests_repo="${tests_repo:-github.com/kata-containers/tests}" export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
export tests_repo_dir="$GOPATH/src/$tests_repo" export tests_repo_dir="$GOPATH/src/$tests_repo"
@ -38,6 +32,44 @@ clone_tests_repo()
clone_tests_repo clone_tests_repo
if [ "$SNAP_CI" == "true" ] && [ "$ID" == "ubuntu" ]; then
# Do not install kata since we want to build, install and test the snap
export INSTALL_KATA="no"
echo "Install snap dependencies"
sudo apt-get install -y snapd snapcraft make
echo "Building snap image"
make snap
echo "Install kata container snap"
sudo snap install --dangerous --classic "$(basename kata-containers_*.snap)"
etc_confile="/etc/kata-containers/configuration.toml"
usr_confile="/usr/share/defaults/kata-containers/configuration.toml"
snap_confile="/snap/kata-containers/current/usr/share/defaults/kata-containers/configuration.toml"
snap_bin_dir="/snap/kata-containers/current/usr/bin"
sudo rm -f /usr/local/bin/kata-runtime \
/usr/bin/kata-runtime \
/usr/local/bin/containerd-shim-kata-v2 \
/usr/bin/containerd-shim-kata-v2 \
"${etc_confile}" "${usr_confile}"
sudo ln -sf ${snap_bin_dir}/kata-runtime /usr/bin/kata-runtime
sudo ln -sf ${snap_bin_dir}/kata-runtime /usr/local/bin/kata-runtime
sudo ln -sf ${snap_bin_dir}/containerd-shim-kata-v2 /usr/bin/containerd-shim-kata-v2
sudo ln -sf ${snap_bin_dir}/containerd-shim-kata-v2 /usr/local/bin/containerd-shim-kata-v2
# copy configuration file since some tests modify it.
sudo mkdir -p "$(dirname "${etc_confile}")" "$(dirname "${usr_confile}")"
sudo cp "${snap_confile}" "${etc_confile}"
sudo cp "${snap_confile}" "${usr_confile}"
"${tests_repo_dir}/cmd/container-manager/manage_ctr_mgr.sh" docker configure -r kata-runtime -f
fi
pushd "${tests_repo_dir}" pushd "${tests_repo_dir}"
.ci/setup.sh .ci/setup.sh
popd popd