Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #429 from devimc/topic/ci/snap
Browse files Browse the repository at this point in the history
ci: run tests using kata snap
  • Loading branch information
Julio Montes authored Apr 11, 2019
2 parents 1d60364 + 58b799b commit f758083
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
5 changes: 0 additions & 5 deletions .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,3 @@ pushd "${tests_repo_dir}"
popd

# This script will execute packaging tests suite

if [ "$ID" == ubuntu ]; then
echo "Building snap image"
make snap
fi
48 changes: 40 additions & 8 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@ set -o pipefail

source /etc/os-release

echo "Setup script for packaging"

if [ "$ID" == ubuntu ]; then
echo "Install snap dependencies"
sudo apt-get install -y snapd snapcraft
SNAP_CI="${SNAP_CI:-false}"

echo "Install kernel dependencies"
sudo -E apt install -y libelf-dev bc gcc
fi
echo "Setup script for packaging"

export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
export tests_repo_dir="$GOPATH/src/$tests_repo"
Expand All @@ -38,6 +32,44 @@ 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}"
.ci/setup.sh
popd

0 comments on commit f758083

Please sign in to comment.