From aed4afde2db82185cdaa970293ceb4b381bf14e2 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Mon, 23 Aug 2021 21:24:55 +0000 Subject: [PATCH] ci: Add pmem CI job This PR adds the possibility to build PMEM to avoid regressions or failures, however, it will not run the test as this needs a special hardware. Fixes #3867 Signed-off-by: Gabriela Cervantes --- .ci/ci_job_flags.sh | 2 +- .ci/run.sh | 2 +- integration/pmem/pmem_test.sh | 59 ++++++++++++++++++++--------------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/.ci/ci_job_flags.sh b/.ci/ci_job_flags.sh index 9d077234c..982344a6c 100755 --- a/.ci/ci_job_flags.sh +++ b/.ci/ci_job_flags.sh @@ -82,7 +82,7 @@ init_ci_flags() { # - If the repo is not "tests", call the repo-specific script (which is # expected to call the script of the same name in the "tests" repo). case "${CI_JOB}" in -"BAREMETAL-PMEM") +"BAREMETAL-PMEM"|"PMEM") init_ci_flags export CRI_CONTAINERD="yes" export CRI_RUNTIME="containerd" diff --git a/.ci/run.sh b/.ci/run.sh index 75aaf08e1..24d15ad2d 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -29,7 +29,7 @@ if [ "$(uname -m)" == "x86_64" ]; then fi case "${CI_JOB}" in - "BAREMETAL-PMEM") + "BAREMETAL-PMEM"|"PMEM") echo "INFO: Running pmem integration test" sudo -E PATH="$PATH" CRI_RUNTIME="containerd" bash -c "make pmem" ;; diff --git a/integration/pmem/pmem_test.sh b/integration/pmem/pmem_test.sh index 2110e8a23..5eaa714eb 100755 --- a/integration/pmem/pmem_test.sh +++ b/integration/pmem/pmem_test.sh @@ -17,6 +17,7 @@ source /etc/os-release || source /usr/lib/os-release TEST_INITRD="${TEST_INITRD:-no}" experimental_qemu="${experimental_qemu:-false}" arch=$("${dir_path}"/../../.ci/kata-arch.sh -d) +CI_JOB="${CI_JOB:-}" if [ "$TEST_INITRD" == "yes" ]; then echo "Skip pmem test: nvdimm is disabled when initrd is used as rootfs" @@ -44,37 +45,27 @@ init() { cleanup() { set +e - kubectl describe pod/my-csi-kata-app - kubectl get pod --all-namespaces + if [[ $CI_JOB == "PMEM_BAREMETAL" ]]; then + kubectl describe pod/my-csi-kata-app + kubectl get pod --all-namespaces + + pushd pmem-csi + kubectl delete -f "deploy/common/pmem-kata-app.yaml" + kubectl delete -f "deploy/common/pmem-kata-pvc.yaml" + kubectl delete -f "deploy/common/pmem-storageclass-ext4-kata.yaml" + kubectl delete PmemCSIDeployment/pmem-csi.intel.com + kubectl delete -f "deploy/crd/pmem-csi.intel.com_pmemcsideployments.yaml" + kubectl delete -f "deploy/operator/pmem-csi-operator.yaml" + popd + fi - pushd pmem-csi - kubectl delete -f "deploy/common/pmem-kata-app.yaml" - kubectl delete -f "deploy/common/pmem-kata-pvc.yaml" - kubectl delete -f "deploy/common/pmem-storageclass-ext4-kata.yaml" - kubectl delete PmemCSIDeployment/pmem-csi.intel.com - kubectl delete -f "deploy/crd/pmem-csi.intel.com_pmemcsideployments.yaml" - kubectl delete -f "deploy/operator/pmem-csi-operator.yaml" - popd rm -rf pmem-csi - ${dir_path}/../../integration/kubernetes/cleanup_env.sh } run_test() { - kubectl exec pod/my-csi-kata-app -- df /data | grep pmem - kubectl exec pod/my-csi-kata-app -- mount | grep pmem | grep data | grep dax -} - -setup_pmem_csi() { - git clone https://github.com/intel/pmem-csi/ pushd pmem-csi - make BUILD_ARGS="--build-arg LINUX_BASE=public.ecr.aws/debian/debian:buster-slim" build-images - make push-images - - kubectl label node $(hostname) storage=pmem - kubectl label node $(hostname) katacontainers.io/kata-runtime=true - oper_yml="deploy/operator/pmem-csi-operator.yaml" sed -i -e 's|image:.*|image: localhost:5000/pmem-csi-driver:canary|g' \ -e 's|imagePullPolicy:.*|imagePullPolicy: Always|g' \ @@ -105,17 +96,33 @@ EOF -e 's|runtimeClassName:.*|runtimeClassName: kata|g' \ "${app_yml}" kubectl apply -f "${app_yml}" - popd - kubectl wait --for=condition=Ready --timeout=90s pod/my-csi-kata-app + kubectl wait --for=condition=Ready --timeout=120s pod/my-csi-kata-app sleep 5 + + popd + + kubectl exec pod/my-csi-kata-app -- df /data | grep pmem + kubectl exec pod/my-csi-kata-app -- mount | grep pmem | grep data | grep dax +} + +setup_pmem_csi() { + git clone https://github.com/intel/pmem-csi/ + pushd pmem-csi + + make build-images + make push-images + + kubectl label node $(hostname) storage=pmem + kubectl label node $(hostname) katacontainers.io/kata-runtime=true + popd } main() { trap cleanup EXIT QUIT KILL init setup_pmem_csi - run_test + [[ $CI_JOB != "PMEM_BAREMETAL" ]] || run_test } main