ci: fix detection of GH actions extra disk

The 'extra' block device attached to GH actions runners has changed size
twice in 3 months. The previous strategy of detecting the disk by size
is becoming harder to maintain. Additionally, the block size with recent
changes (75G) is now the same as the boot device (also 75G), making the
method inexact.

The method can now be summarized as, "find the boot disk and choose the
disk that isn't the boot disk to be the 'extra' one used."

Prior to this, we used a one-liner based on `lsblk`. While we could
still make this a one-liner, the method is now updated to 2 effective
lines, plus debug text output to stderr to help if we need to debug
further in the future.

Of note, the 'extra' disk has a mount point of "/mnt", but it is unclear
whether this is a reliable heuristic for detecting the extra disk. For
years now, GH action runners have had only 2 disks. Therefore, it seems
slightly more likely that a heuristic to "choose the non-boot disk" will
be a more robust long-term solution.

If this strategy proves to be unreliable in the future, it may be wise
to consider whether "the device with a partition mounted to '/mnt'"
would be a good alternative.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
This commit is contained in:
Blaine Gardner
2024-02-05 17:55:16 -07:00
parent 577c7cc636
commit feacb6424e
12 changed files with 87 additions and 59 deletions
+17 -14
View File
@@ -303,7 +303,7 @@ jobs:
- name: use local disk as OSD
run: |
tests/scripts/github-action-helper.sh use_local_disk
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only
- name: prepare loop devices for osds
@@ -370,7 +370,7 @@ jobs:
- name: use local disk as OSD
run: |
tests/scripts/github-action-helper.sh use_local_disk
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only
- name: deploy cluster
@@ -416,7 +416,7 @@ jobs:
- name: use local disk as OSD
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh use_local_disk
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only
@@ -469,7 +469,7 @@ jobs:
- name: use local disk as OSD
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh use_local_disk
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only
@@ -516,13 +516,13 @@ jobs:
- name: use local disk as OSD
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh use_local_disk
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only
- name: create LV on disk
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh create_LV_on_disk $BLOCK
- name: deploy cluster
@@ -574,7 +574,7 @@ jobs:
- name: create cluster prerequisites
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/localPathPV.sh "$BLOCK"
tests/scripts/loopDevicePV.sh 1
tests/scripts/github-action-helper.sh create_cluster_prerequisites
@@ -605,7 +605,7 @@ jobs:
kubectl -n rook-ceph logs deploy/rook-ceph-operator
tests/scripts/github-action-helper.sh wait_for_cleanup_pod
lsblk
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
sudo head --bytes=60 ${BLOCK}1
sudo head --bytes=60 ${BLOCK}2
sudo head --bytes=60 /dev/loop1
@@ -744,7 +744,8 @@ jobs:
- name: create cluster prerequisites
run: |
tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/localPathPV.sh "$BLOCK"
tests/scripts/github-action-helper.sh create_cluster_prerequisites
- name: deploy cluster
@@ -770,7 +771,7 @@ jobs:
kubectl -n rook-ceph delete cephcluster rook-ceph
kubectl -n rook-ceph logs deploy/rook-ceph-operator
tests/scripts/github-action-helper.sh wait_for_cleanup_pod
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
sudo head --bytes=60 ${BLOCK}1
sudo head --bytes=60 ${BLOCK}2
sudo lsblk
@@ -920,7 +921,8 @@ jobs:
- name: create cluster prerequisites
run: |
tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/localPathPV.sh "$BLOCK"
tests/scripts/github-action-helper.sh create_cluster_prerequisites
- name: deploy vault
@@ -1002,7 +1004,8 @@ jobs:
- name: create cluster prerequisites
run: |
tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/localPathPV.sh "$BLOCK"
tests/scripts/github-action-helper.sh create_cluster_prerequisites
- name: deploy vault
@@ -1065,7 +1068,7 @@ jobs:
- name: create LV on disk
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh create_LV_on_disk $BLOCK
tests/scripts/localPathPV.sh /dev/test-rook-vg/test-rook-lv
@@ -1114,7 +1117,7 @@ jobs:
- name: use local disk into two partitions
run: |
tests/scripts/github-action-helper.sh use_local_disk
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 2
sudo lsblk
+8 -7
View File
@@ -62,6 +62,7 @@ jobs:
- name: use local disk and create partitions for osds
run: |
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh use_local_disk
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 1
@@ -135,7 +136,7 @@ jobs:
- name: TestCephSmokeSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION="quincy-devel" go test -v -timeout 1800s -run TestCephSmokeSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -175,7 +176,7 @@ jobs:
- name: TestCephSmokeSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION="reef-devel" go test -v -timeout 1800s -run TestCephSmokeSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -215,7 +216,7 @@ jobs:
- name: TestCephSmokeSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION=main go test -v -timeout 1800s -run TestCephSmokeSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -255,7 +256,7 @@ jobs:
- name: TestCephObjectSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION="quincy-devel" go test -v -timeout 1800s -failfast -run TestCephObjectSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -295,7 +296,7 @@ jobs:
- name: TestCephObjectSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION=main go test -v -timeout 1800s -failfast -run TestCephObjectSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -335,7 +336,7 @@ jobs:
- name: TestCephUpgradeSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 1800s -failfast -run TestCephUpgradeSuite/TestUpgradeCephToReefDevel github.com/rook/rook/tests/integration
- name: collect common logs
@@ -375,7 +376,7 @@ jobs:
- name: TestCephUpgradeSuite
run: |
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 1800s -failfast -run TestCephUpgradeSuite/TestUpgradeCephToQuincyDevel github.com/rook/rook/tests/integration
- name: collect common logs
@@ -35,7 +35,8 @@ runs:
- name: create cluster prerequisites
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/localPathPV.sh "$BLOCK"
tests/scripts/github-action-helper.sh create_cluster_prerequisites
- name: deploy cluster
@@ -50,7 +50,7 @@ jobs:
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
tests/scripts/github-action-helper.sh create_helm_tag
tests/scripts/helm.sh up
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_TEST_CLEANUP=false SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -failfast -run CephHelmSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -45,7 +45,7 @@ jobs:
- name: TestCephMgrSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 1800s -failfast -run CephMgrSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -45,8 +45,9 @@ jobs:
- name: TestCephMultiClusterDeploySuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export TEST_SCRATCH_DEVICE=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)1
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
export TEST_SCRATCH_DEVICE="${BLOCK}1"
export DEVICE_FILTER="$BLOCK"
go test -v -timeout 1800s -failfast -run CephMultiClusterDeploySuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -45,7 +45,7 @@ jobs:
- name: TestCephObjectSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false go test -v -timeout 2400s -failfast -run CephObjectSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -45,7 +45,7 @@ jobs:
- name: TestCephSmokeSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -failfast -run CephSmokeSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -45,7 +45,7 @@ jobs:
- name: TestCephUpgradeSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 2400s -failfast -run CephUpgradeSuite/TestUpgradeRook github.com/rook/rook/tests/integration
- name: collect common logs
@@ -92,7 +92,7 @@ jobs:
tests/scripts/helm.sh up
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 1800s -failfast -run CephUpgradeSuite/TestUpgradeHelm github.com/rook/rook/tests/integration
- name: collect common logs
@@ -35,7 +35,7 @@ jobs:
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
tests/scripts/github-action-helper.sh create_helm_tag
tests/scripts/helm.sh up
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_TEST_CLEANUP=false SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -run CephHelmSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -73,8 +73,9 @@ jobs:
- name: TestCephMultiClusterDeploySuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export TEST_SCRATCH_DEVICE=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)1
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
export TEST_SCRATCH_DEVICE="/dev/${BLOCK}1"
export DEVICE_FILTER="$BLOCK"
go test -v -timeout 1800s -run CephMultiClusterDeploySuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -112,7 +113,7 @@ jobs:
- name: TestCephSmokeSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -run CephSmokeSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -150,7 +151,7 @@ jobs:
- name: TestCephUpgradeSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 2400s -run CephUpgradeSuite/TestUpgradeRook github.com/rook/rook/tests/integration
- name: collect common logs
@@ -191,7 +192,7 @@ jobs:
tests/scripts/helm.sh up
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
go test -v -timeout 1800s -run CephUpgradeSuite/TestUpgradeHelm github.com/rook/rook/tests/integration
- name: collect common logs
@@ -229,7 +230,7 @@ jobs:
- name: TestCephObjectSuite
run: |
tests/scripts/github-action-helper.sh collect_udev_logs_in_background
export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1)
export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev)
SKIP_CLEANUP_POLICY=false go test -v -timeout 2400s -failfast -run CephObjectSuite github.com/rook/rook/tests/integration
- name: collect common logs
@@ -15,7 +15,7 @@ runs:
- name: use local disk into two partitions
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)
export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)"
tests/scripts/github-action-helper.sh use_local_disk
tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 2
sudo lsblk