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

Commit

Permalink
ci: Add pmem CI job
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
GabyCT committed Aug 30, 2021
1 parent 4cd975e commit aed4afd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .ci/ci_job_flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
;;
Expand Down
59 changes: 33 additions & 26 deletions integration/pmem/pmem_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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' \
Expand Down Expand Up @@ -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

0 comments on commit aed4afd

Please sign in to comment.