Skip to content

Commit 4abded9

Browse files
committed
ci: update script to get right device filter
currently, deviceFilter was getting `/dev/sdb` instead of `sdb` due to which osd is not getting created. Also, modified few commands to clean disk before using. Signed-off-by: subhamkrai <srai@redhat.com>
1 parent 9d99c26 commit 4abded9

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

tests/github-action-helper.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/usr/bin/env bash
22

3-
set -eEuo pipefail
3+
set -xeEo pipefail
44

5+
#############
6+
# VARIABLES #
7+
#############
58
: "${FUNCTION:=${1}}"
9+
: "${BLOCK:=$(sudo lsblk --paths | awk '/14G/ {print $1}' | head -1)}"
610

711
# source https://krew.sigs.k8s.io/docs/user-guide/setup/install/
812
install_krew() {
@@ -19,19 +23,21 @@ install_krew() {
1923

2024
# source https://github.com/rook/rook
2125
use_local_disk() {
26+
BLOCK_DATA_PART=${BLOCK}1
27+
sudo apt purge snapd -y
28+
sudo dmsetup version || true
2229
sudo swapoff --all --verbose
2330
sudo umount /mnt
2431
# search for the device since it keeps changing between sda and sdb
25-
sudo wipefs --all --force /dev/"$(lsblk | awk '/14G/ {print $1}' | head -1)"1
26-
sudo lsblk
32+
sudo wipefs --all --force "$BLOCK_DATA_PART"
2733
}
2834

2935
deploy_rook() {
3036
kubectl create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/common.yaml
3137
kubectl create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/crds.yaml
3238
kubectl create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/operator.yaml
3339
curl https://raw.githubusercontent.com/rook/rook/master/deploy/examples/cluster-test.yaml -o cluster-test.yaml
34-
sed -i "s|#deviceFilter:|deviceFilter: $(lsblk | awk '/14G/ {print $1}' | head -1)|g" cluster-test.yaml
40+
sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\//}|g" cluster-test.yaml
3541
sed -i '0,/count: 1/ s/count: 1/count: 3/' cluster-test.yaml
3642
kubectl create -f cluster-test.yaml
3743
wait_for_pod_to_be_ready_state_default
@@ -53,7 +59,7 @@ deploy_rook_in_custom_namespace() {
5359
curl -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/operator.yaml -o operator.yaml
5460
deploy_with_custom_ns "$1" "$2" operator.yaml
5561
curl https://raw.githubusercontent.com/rook/rook/master/deploy/examples/cluster-test.yaml -o cluster-test.yaml
56-
sed -i "s|#deviceFilter:|deviceFilter: $(lsblk | awk '/14G/ {print $1}' | head -1)|g" cluster-test.yaml
62+
sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\//}|g" cluster-test.yaml
5763
sed -i '0,/count: 1/ s/count: 1/count: 3/' cluster-test.yaml
5864
deploy_with_custom_ns "$1" "$2" cluster-test.yaml
5965
wait_for_pod_to_be_ready_state_custom

0 commit comments

Comments
 (0)