Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1249 from chavafg/topic/backport-fixes-1.5
Browse files Browse the repository at this point in the history
backport fixes to stable-1.5
  • Loading branch information
Julio Montes authored Feb 27, 2019
2 parents 1302edc + 1468206 commit 64925f3
Show file tree
Hide file tree
Showing 46 changed files with 853 additions and 133 deletions.
44 changes: 44 additions & 0 deletions .ci/hypervisors/firecracker/configuration_firecracker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

# We need to skip some docker integration tests as they are not
# running correctly using Firecracker. We will skip them using
# the ginkgo flag 'skip=REGEXP'.
test:
- docker
docker:
Describe:
- restart
- docker exec
- capabilities
- package manager update test
- build with docker
- inspect
- docker top
- users and groups
- terminal with docker
- docker commit
- ulimits
- docker cp with volume attached
- load with docker
- docker volume
- docker env
- CPUs and CPU set
- docker exit code
- run container with docker
- run hot plug block devices
- pause with docker
- Update number of CPUs
- docker cp
- docker privileges
- diff
- Hot plug CPUs
- Update CPU constraints
- memory constraints
- Hotplug memory when create containers
- run container and update its memory constraints
Context:
- remove bind-mount source before container exits
It:
50 changes: 50 additions & 0 deletions .ci/hypervisors/firecracker/filter_docker_firecracker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

set -e

cidir=$(dirname "$0")
source "${cidir}/../../lib.sh"

test_config_file="${cidir}/configuration_firecracker.yaml"

describe_skip_flag="docker.Describe"
context_skip_flag="docker.Context"
it_skip_flag="docker.It"

# value for '-skip' in ginkgo
_skip_options=()

filter_and_build() {
local dependency="$1"
local array_docker=$("${GOPATH}/bin/yq" read "${test_config_file}" "${dependency}")
[ "${array_docker}" = "null" ] && return
mapfile -t _array_docker <<< "${array_docker}"
for entry in "${_array_docker[@]}"
do
_skip_options+=("${entry#- }|")
done
}

main() {
# Check if yq is installed
[ -z "$(command -v yq)" ] && install_yq

# Build skip option based on Describe block
filter_and_build "${describe_skip_flag}"

# Build skip option based on context block
filter_and_build "${context_skip_flag}"

# Build skip option based on it block
filter_and_build "${it_skip_flag}"

skip_options=$(IFS= ; echo "${_skip_options[*]}")

echo "${skip_options%|}"
}

main
34 changes: 19 additions & 15 deletions .ci/install_firecracker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set -o pipefail
cidir=$(dirname "$0")
arch=$("${cidir}"/kata-arch.sh -d)
source "${cidir}/lib.sh"
KATA_DEV_MODE="${KATA_DEV_MODE:-false}"

if [ "$arch" != "x86_64" ]; then
die "Static binaries for Firecracker only available with x86_64."
Expand All @@ -26,17 +27,23 @@ if [ "$docker_version" != "18.06" ]; then
die "Firecracker hypervisor only works with docker 18.06"
fi

# This is the initial release of Kata
# Containers that introduces support for
# the Firecracker hypervisor
release_version="1.5.0-rc2"
file_name="kata-fc-static-${release_version}-${arch}.tar.gz"
url="https://github.com/kata-containers/runtime/releases/download/${release_version}/${file_name}"
echo "Get static binaries from release version ${release_version}"
curl -OL ${url}
# Get url for firecracker from runtime/versions.yaml
firecracker_repo=$(get_version "assets.hypervisor.firecracker.url")
[ -n "$firecracker_repo" ] || die "failed to get firecracker repo"
firecracker_repo=${firecracker_repo/https:\/\//}

echo "Decompress binaries from release version ${release_version}"
sudo tar -xvf ${file_name} -C /
# Get version for firecracker from runtime/versions.yaml
firecracker_version=$(get_version "assets.hypervisor.firecracker.version")
[ -n "$firecracker_version" ] || die "failed to get firecracker version"

# Get firecracker
go get -d ${firecracker_repo} || true
# Checkout to specific version
pushd "${GOPATH}/src/${firecracker_repo}"
git checkout tags/${firecracker_version}
./tools/devtool --unattended build --release -- --features vsock
sudo install ${GOPATH}/src/${firecracker_repo}/build/release/firecracker /usr/bin/
popd

echo "Install and configure docker"
docker_configuration_path="/etc/docker"
Expand All @@ -51,10 +58,7 @@ docker_configuration_file=$docker_configuration_path/daemon.json
# is required
driver="devicemapper"

# From decompressing the tarball, all the files are placed within
# /opt/kata. The runtime configuration is expected to land at
# /opt/kata/share/defaults/kata-containers/configuration.toml
path="/opt/kata/bin/kata-runtime"
path="/usr/local/bin/kata-runtime"

if [ -f $docker_configuration_file ]; then
# Check devicemapper flag
Expand All @@ -67,7 +71,7 @@ else
cat <<-EOF | sudo tee "$docker_configuration_file"
{
"runtimes": {
"kata": {
"kata-runtime": {
"path": "${path}"
}
},
Expand Down
5 changes: 4 additions & 1 deletion .ci/install_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ case "$(arch)" in
"ppc64le")
goarch=ppc64le
;;


"s390x")
goarch=s390x
;;
"*")
die "Arch $(arch) not supported"
;;
Expand Down
3 changes: 1 addition & 2 deletions .ci/install_kata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set -o pipefail
cidir=$(dirname "$0")
source /etc/os-release || source /usr/lib/os-release
source "${cidir}/lib.sh"

KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"

echo "Install kata-containers image"
Expand All @@ -21,7 +20,7 @@ echo "Install kata-containers image"
echo "Install Kata Containers Kernel"
"${cidir}/install_kata_kernel.sh"

if [ "$KATA_HYPERVISOR" == firecracker ]; then
if [ "$KATA_HYPERVISOR" == "firecracker" ]; then
echo "Install Firecracker"
"${cidir}/install_firecracker.sh"
else
Expand Down
56 changes: 32 additions & 24 deletions .ci/install_qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cidir=$(dirname "$0")
source "${cidir}/lib.sh"
source /etc/os-release || source /usr/lib/os-release

CURRENT_QEMU_BRANCH=$(get_version "assets.hypervisor.qemu-lite.branch")
CURRENT_QEMU_COMMIT=$(get_version "assets.hypervisor.qemu-lite.commit")
PACKAGED_QEMU="qemu-lite"
QEMU_ARCH=$(${cidir}/kata-arch.sh -d)
Expand Down Expand Up @@ -51,20 +52,21 @@ install_packaged_qemu() {
}

build_and_install_qemu() {
QEMU_REPO=$(get_version "assets.hypervisor.qemu-lite.url")
QEMU_REPO_URL=$(get_version "assets.hypervisor.qemu-lite.url")
# Remove 'https://' from the repo url to be able to clone the repo using 'go get'
QEMU_REPO=${QEMU_REPO/https:\/\//}
QEMU_REPO=${QEMU_REPO_URL/https:\/\//}
PACKAGING_REPO="github.com/kata-containers/packaging"
QEMU_CONFIG_SCRIPT="${GOPATH}/src/${PACKAGING_REPO}/scripts/configure-hypervisor.sh"

go get -d "${QEMU_REPO}" || true
mkdir -p "${GOPATH}/src"
git clone --branch "$CURRENT_QEMU_BRANCH" --single-branch "${QEMU_REPO_URL}" "${GOPATH}/src/${QEMU_REPO}"
go get -d "$PACKAGING_REPO" || true

pushd "${GOPATH}/src/${QEMU_REPO}"
git fetch
git checkout "$CURRENT_QEMU_COMMIT"
[ -d "capstone" ] || git clone https://github.com/qemu/capstone.git capstone
[ -d "ui/keycodemapdb" ] || git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
[ -n "$(ls -A capstone)" ] || git clone https://github.com/qemu/capstone.git capstone
[ -n "$(ls -A ui/keycodemapdb)" ] || git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb

# Apply required patches
QEMU_PATCHES_PATH="${GOPATH}/src/${PACKAGING_REPO}/obs-packaging/qemu-lite/patches"
Expand All @@ -91,25 +93,31 @@ if [ -f "${cidir}/${QEMU_ARCH}/lib_install_qemu_${QEMU_ARCH}.sh" ]; then
fi

main() {
if [ "$QEMU_ARCH" == "x86_64" ]; then
packaged_qemu_commit=$(get_packaged_qemu_commit)
short_current_qemu_commit=${CURRENT_QEMU_COMMIT:0:10}
if [ "$packaged_qemu_commit" == "$short_current_qemu_commit" ]; then
# If installing packaged qemu from OBS fails,
# then build and install it from sources.
install_packaged_qemu || build_and_install_qemu
else
build_and_install_qemu
fi
elif [ "$QEMU_ARCH" == "aarch64" ] || [ "$QEMU_ARCH" == "ppc64le" ]; then
packaged_qemu_version=$(get_packaged_qemu_version)
short_current_qemu_version=${CURRENT_QEMU_VERSION#*-}
if [ "$packaged_qemu_version" == "$short_current_qemu_version" ] && [ -z "${CURRENT_QEMU_COMMIT}" ]; then
install_packaged_qemu || build_and_install_qemu
else
build_and_install_qemu
fi
fi
case "$QEMU_ARCH" in
"x86_64")
packaged_qemu_commit=$(get_packaged_qemu_commit)
short_current_qemu_commit=${CURRENT_QEMU_COMMIT:0:10}
if [ "$packaged_qemu_commit" == "$short_current_qemu_commit" ]; then
# If installing packaged qemu from OBS fails,
# then build and install it from sources.
install_packaged_qemu || build_and_install_qemu
else
build_and_install_qemu
fi
;;
"aarch64"|"ppc64le"|"s390x")
packaged_qemu_version=$(get_packaged_qemu_version)
short_current_qemu_version=${CURRENT_QEMU_VERSION#*-}
if [ "$packaged_qemu_version" == "$short_current_qemu_version" ] && [ -z "${CURRENT_QEMU_COMMIT}" ] || [ "${QEMU_ARCH}" == "s390x" ]; then
install_packaged_qemu || build_and_install_qemu
else
build_and_install_qemu
fi
;;
*)
die "Architecture $QEMU_ARCH not supported"
;;
esac
}

main
9 changes: 7 additions & 2 deletions .ci/install_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ cidir=$(dirname "$0")

source "${cidir}/lib.sh"
source /etc/os-release || source /usr/lib/os-release

KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"

# Modify the runtimes build-time defaults
Expand Down Expand Up @@ -79,11 +78,17 @@ if [ "$USE_VSOCK" == "yes" ]; then
fi
fi

if [ "$KATA_HYPERVISOR" == qemu ]; then
if [ "$KATA_HYPERVISOR" == "qemu" ]; then
echo "Add runtime as a new/default Docker runtime. Docker version \"$(docker --version)\" could change according to updates."
docker_options="-D --add-runtime kata-runtime=/usr/local/bin/kata-runtime"
echo "Add kata-runtime as a new/default Docker runtime."
"${cidir}/../cmd/container-manager/manage_ctr_mgr.sh" docker configure -r kata-runtime -f
else
echo "Kata runtime will not set as a default in Docker"
fi

if [ "$KATA_HYPERVISOR" == "firecracker" ]; then
echo "Enable firecracker configuration.toml"
path="/usr/share/defaults/kata-containers"
sudo mv ${path}/configuration-fc.toml ${path}/configuration.toml
fi
14 changes: 4 additions & 10 deletions .ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export KATA_RUNTIME=${KATA_RUNTIME:-kata-runtime}
# more formats).
export KATA_DOCKER_TIMEOUT=30

# Ensure GOPATH set
export GOPATH=${GOPATH:-$(go env GOPATH)}

tests_repo="${tests_repo:-github.com/kata-containers/tests}"
lib_script="${GOPATH}/src/${tests_repo}/lib/common.bash"
source "${lib_script}"
Expand Down Expand Up @@ -86,7 +89,6 @@ function build_and_install() {
}

function install_yq() {
GOPATH=${GOPATH:-${HOME}/go}
local yq_path="${GOPATH}/bin/yq"
local yq_pkg="github.com/mikefarah/yq"
[ -x "${GOPATH}/bin/yq" ] && return
Expand Down Expand Up @@ -153,7 +155,6 @@ function get_dep_from_yaml_db(){

function get_version(){
dependency="$1"
GOPATH=${GOPATH:-${HOME}/go}
runtime_repo="github.com/kata-containers/runtime"
runtime_repo_dir="$GOPATH/src/${runtime_repo}"
versions_file="${runtime_repo_dir}/versions.yaml"
Expand All @@ -177,13 +178,6 @@ function get_test_version(){
get_dep_from_yaml_db "${db}" "${dependency}"
}

function check_gopath() {
# Verify GOPATH is set
if [ -z "$GOPATH" ]; then
export GOPATH=$(go env GOPATH)
fi
}

function waitForProcess(){
wait_time="$1"
sleep_time="$2"
Expand Down Expand Up @@ -226,7 +220,7 @@ delete_stale_docker_resource()
local mount_point_union=$(mount | grep "${stale_docker_mount_point}" | awk '{print $3}')
if [ -n "${mount_point_union}" ]; then
while IFS='$\n' read mount_point; do
sudo umount "${mount_point}"
[ -n "$(grep "${mount_point}" "/proc/mounts")" ] && sudo umount -R "${mount_point}"
done <<< "${mount_point_union}"
fi
done
Expand Down
24 changes: 24 additions & 0 deletions .ci/ppc64le/configuration_ppc64le.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2019 IBM
#
# SPDX-License-Identifier: Apache-2.0

# for now, not all integration test suites are fully passed in ppc64le.
# some need to be tested, and some need to be refined.
# sequence of 'test' holds supported integration tests components.
test:
- functional
- docker
- docker-compose

# for now, not all test suites under docker integration are fully passed in aarch64.
# some need to be tested, and some need to be refined.
# ginkgo offers '-skip=REGEXP' flag to skip specific ones.
# you can use infos from docker.Describe, docker.Context or docker.It to point to
# specific test specs or whole container of specs.
docker:
Describe:
- Update CPU set
Context:
It:
- should have the right number of vCPUs
Loading

0 comments on commit 64925f3

Please sign in to comment.