Skip to content

Commit

Permalink
CI: bugfix for dragonball when CI running with cri-containerd
Browse files Browse the repository at this point in the history
Containerd runtime options with wrong setting cause it failed.
Correct it as below:
...
 [plugins.cri.containerd.runtimes.${runtime}.options]
   ConfigPath= "${KATA_CONFIG_PATH}"
...

Fixes: #8746

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
  • Loading branch information
Apokleos committed Jan 11, 2024
1 parent a4abbd7 commit 8f6b812
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions tests/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ function enabling_hypervisor() {
declare -r DEST_KATA_CONFIG="${CONFIG_DIR}/configuration.toml"

sudo ln -sf "${SRC_HYPERVISOR_CONFIG}" "${DEST_KATA_CONFIG}"

export KATA_CONFIG_PATH="${DEST_KATA_CONFIG}"
}


Expand Down
21 changes: 15 additions & 6 deletions tests/integration/cri-containerd/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ readonly default_kata_config="/opt/kata/share/defaults/kata-containers/configura

function ci_config() {
sudo mkdir -p $(dirname "${kata_config}")
[ -f "$kata_config" ] && sudo cp "$kata_config" "$kata_config_backup" || \
sudo cp "$default_kata_config" "$kata_config"
[ -f "$kata_config" ] && sudo cp "$kata_config" "$kata_config_backup"
sudo cp -f "${KATA_CONFIG_PATH}" "$kata_config"

source /etc/os-release || source /usr/lib/os-release
ID=${ID:-""}
Expand Down Expand Up @@ -88,10 +88,18 @@ function create_containerd_config() {
[ -n "${runtime}" ] || die "need runtime to create config"

local runtime_type="${containerd_runtime_type}"

local runtime_config_path="${kata_config}"

local containerd_runtime=$(command -v "containerd-shim-${runtime}-v2")
local runtime_binary_path="${containerd_runtime}"

if [ "${runtime}" == "runc" ]; then
runtime_type="io.containerd.runc.v2"
runtime_config_path=""
runtime_binary_path=""
fi
local containerd_runtime=$(command -v "containerd-shim-${runtime}-v2")
info "Kata Config Path ${runtime_config_path}, Runtime Binary Name ${runtime_binary_path}"

cat << EOF | sudo tee "${CONTAINERD_CONFIG_FILE}"
[debug]
Expand All @@ -107,7 +115,8 @@ cat << EOF | sudo tee "${CONTAINERD_CONFIG_FILE}"
echo ' container_annotations = ["io.katacontainers.*"]'
)
[plugins.cri.containerd.runtimes.${runtime}.options]
Runtime = "${containerd_runtime}"
ConfigPath = "${runtime_config_path}"
BinaryName = "${runtime_binary_path}"
[plugins.linux]
shim = "${containerd_shim_path}"
EOF
Expand Down Expand Up @@ -248,11 +257,11 @@ function TestContainerMemoryUpdate() {
if [[ "$ARCH" != "x86_64" ]]; then
return
fi
info "Test container memory update with virtio-mem"
info "Test container memory update with virtio-mem and config path ${kata_config}"

sudo sed -i -e 's/^#enable_virtio_mem.*$/enable_virtio_mem = true/g' "${kata_config}"
else
info "Test container memory update without virtio-mem"
info "Test container memory update without virtio-mem and config path ${kata_config}"

sudo sed -i -e 's/^enable_virtio_mem.*$/#enable_virtio_mem = true/g' "${kata_config}"
fi
Expand Down

0 comments on commit 8f6b812

Please sign in to comment.