From 79e6ff6dd221ced11bdeb0c61344adfb09d5ae62 Mon Sep 17 00:00:00 2001 From: Penny Zheng Date: Tue, 31 Jul 2018 03:15:20 +0000 Subject: [PATCH] ci: practice filter scheme in setup.sh since not all integration suites supported in aarch64 for now, ommiting unrelated installation in setup.sh could be necessary. Fixes: #472 Signed-off-by: Penny Zheng Signed-off-by: Wei Chen --- .ci/lib_setup_aarch64.sh | 23 +++++++++++++++++++++++ .ci/setup.sh | 33 +++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 .ci/lib_setup_aarch64.sh diff --git a/.ci/lib_setup_aarch64.sh b/.ci/lib_setup_aarch64.sh new file mode 100644 index 0000000000..896dd98ca0 --- /dev/null +++ b/.ci/lib_setup_aarch64.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright (c) 2018 ARM Limited +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +filter_test_script="${cidir}/filter_test_aarch64.sh" + +check_test_union() +{ + local test_union=$(bash -f ${filter_test_script}) + flag="$1" + # regex match + [[ ${test_union} =~ ${flag} ]] && echo "true" + + echo "false" +} + +CRIO=$(check_test_union crio) +KUBERNETES=$(check_test_union kubernetes) +OPENSHIFT=$(check_test_union openshift) diff --git a/.ci/setup.sh b/.ci/setup.sh index 02fb16344d..971181bb4e 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -13,7 +13,7 @@ source "${cidir}/lib.sh" apply_depends_on -arch=$(arch) +arch=$("${cidir}"/kata-arch.sh -d) INSTALL_KATA="${INSTALL_KATA:-yes}" echo "Set up environment" @@ -40,15 +40,21 @@ if ! sudo docker version | grep -q "$docker_version" && [ "$CI" == true ]; then "${cidir}/../cmd/container-manager/manage_ctr_mgr.sh" docker install -f fi -if [ "$arch" = x86_64 ]; then +case "$arch" in + x86_64) if grep -q "N" /sys/module/kvm_intel/parameters/nested; then echo "enable Nested Virtualization" sudo modprobe -r kvm_intel sudo modprobe kvm_intel nested=1 fi -else + ;; + aarch64) + info "CI running in bare machine" + ;; + *) die "Unsupported architecture: $arch" -fi + ;; +esac if [ "${INSTALL_KATA}" == "yes" ];then echo "Install Kata sources" @@ -58,14 +64,21 @@ fi echo "Install CNI plugins" bash -f "${cidir}/install_cni_plugins.sh" -echo "Install CRI-O" -bash -f "${cidir}/install_crio.sh" +# values indicating whether related intergration tests have been supported +CRIO="true" +KUBERNETES="true" +OPENSHIFT="true" + +# load arch-specific lib file +if [ -f "${cidir}/lib_setup_${arch}.sh" ]; then + source "${cidir}/lib_setup_${arch}.sh" +fi + +[ "${CRIO}" = "true" ] && echo "Install CRI-O" && bash -f "${cidir}/install_crio.sh" -echo "Install Kubernetes" -bash -f "${cidir}/install_kubernetes.sh" +[ "${KUBERNETES}" = "true" ] && echo "Install Kubernetes" && bash -f "${cidir}/install_kubernetes.sh" -echo "Install Openshift" -bash -f "${cidir}/install_openshift.sh" +[ "${OPENSHIFT}" = "true" ] && echo "Install Openshift" && bash -f "${cidir}/install_openshift.sh" echo "Disable systemd-journald rate limit" sudo crudini --set /etc/systemd/journald.conf Journal RateLimitInterval 0s