From b178c8ae2c5c2d5d1c793fc2806f2f845ed193d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 19 May 2021 10:25:34 +0200 Subject: [PATCH] ci: add arm64 hosted runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to @xin3liang we now have 2 hosted runners on ARM64. So let's add a small integration test for it. The action will run every day at midnight. Successful run: https://github.com/rook/rook/pull/7946/checks?check_run_id=2726403458 Signed-off-by: Sébastien Han --- .../canary-integration-test-arm64.yml | 74 +++++++++++++++++++ tests/scripts/github-action-helper.sh | 17 +++-- 2 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/canary-integration-test-arm64.yml diff --git a/.github/workflows/canary-integration-test-arm64.yml b/.github/workflows/canary-integration-test-arm64.yml new file mode 100644 index 000000000..5d3f0dce6 --- /dev/null +++ b/.github/workflows/canary-integration-test-arm64.yml @@ -0,0 +1,74 @@ +name: Canary integration tests ARM64 +on: + schedule: + - cron: '0 0 * * *' # every day at midnight + +jobs: + canary-arm64: + runs-on: [self-hosted, ubuntu-20.04, ARM64] + env: + BLOCK: /dev/sdb + + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: setup golang + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: teardown minikube and docker + run: | + uptime + minikube delete + docker system prune -a + + - name: setup minikube + run: | + # sudo apt-get install build-essential -y + # curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-arm64 + # sudo install minikube-linux-arm64 /usr/local/bin/minikube + # sudo rm -f minikube-linux-arm64 + # curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl" + # sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + minikube start --memory 28g --cpus=12 --driver=docker + + - name: print k8s cluster status + run: tests/scripts/github-action-helper.sh print_k8s_cluster_status + + - name: use local disk and create partitions for osds + run: | + tests/scripts/github-action-helper.sh use_local_disk + tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 1 + + - name: validate-yaml + run: tests/scripts/github-action-helper.sh validate_yaml + + - name: deploy cluster + run: | + # removing liveness probes since the env is slow and the probe is killing the daemons + yq write -d1 -i cluster/examples/kubernetes/ceph/cluster-test.yaml "spec.healthCheck.livenessProbe.mon.disabled" true + yq write -d1 -i cluster/examples/kubernetes/ceph/cluster-test.yaml "spec.healthCheck.livenessProbe.mgr.disabled" true + yq write -d1 -i cluster/examples/kubernetes/ceph/cluster-test.yaml "spec.healthCheck.livenessProbe.osd.disabled" true + tests/scripts/github-action-helper.sh deploy_cluster + # there are no package for arm64 nfs-ganesha + kubectl delete -f cluster/examples/kubernetes/ceph/nfs-test.yaml + + - name: wait for prepare pod + run: timeout 900 sh -c 'until kubectl -n rook-ceph logs -f $(kubectl -n rook-ceph get pod -l app=rook-ceph-osd-prepare -o jsonpath='{.items[*].metadata.name}'); do sleep 5; done' || kubectl -n rook-ceph get all && kubectl logs -n rook-ceph deploy/rook-ceph-operator + + - name: wait for ceph to be ready + run: tests/scripts/github-action-helper.sh wait_for_ceph_to_be_ready all 1 + + - name: teardown minikube and docker + run: | + minikube delete + docker system prune -a + + - name: upload canary test result + uses: actions/upload-artifact@v2 + if: always() + with: + name: canary-arm64 + path: test diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index d97c919b1..7fbd258a4 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -19,7 +19,7 @@ set -xe ############# # VARIABLES # ############# -BLOCK=$(sudo lsblk --paths | awk '/14G/ {print $1}' | head -1) +: "${BLOCK:=$(sudo lsblk --paths | awk '/14G/ {print $1}' | head -1)}" ############# # FUNCTIONS # @@ -39,9 +39,16 @@ function use_local_disk() { BLOCK_DATA_PART=${BLOCK}1 sudo dmsetup version || true sudo swapoff --all --verbose - sudo umount /mnt - # search for the device since it keeps changing between sda and sdb - sudo wipefs --all --force "$BLOCK_DATA_PART" + if mountpoint -q /mnt; then + sudo umount /mnt + # search for the device since it keeps changing between sda and sdb + sudo wipefs --all --force "$BLOCK_DATA_PART" + else + # it's the hosted runner! + sudo sgdisk --zap-all --clear --mbrtogpt -g -- "${BLOCK}" + sudo dd if=/dev/zero of="${BLOCK}" bs=1M count=10 oflag=direct + sudo parted -s "${BLOCK}" mklabel gpt + fi sudo lsblk } @@ -113,7 +120,7 @@ function create_cluster_prerequisites() { function deploy_cluster() { cd cluster/examples/kubernetes/ceph kubectl create -f operator.yaml - sed -i "s|#deviceFilter:|deviceFilter: $(lsblk | awk '/14G/ {print $1}' | head -1)|g" cluster-test.yaml + sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\/}|g" cluster-test.yaml kubectl create -f cluster-test.yaml kubectl create -f object-test.yaml kubectl create -f pool-test.yaml