diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index ccb3afe5f..c1367c3b2 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -164,6 +164,98 @@ jobs: uses: mxschmitt/action-tmate@v3 timeout-minutes: 60 + raw-disk: + runs-on: ubuntu-18.04 + if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')" + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: setup cluster resources + uses: ./.github/workflows/setup-cluster-resources + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: validate-yaml + run: tests/scripts/github-action-helper.sh validate_yaml + + - name: use local disk as OSD + run: | + tests/scripts/github-action-helper.sh use_local_disk + BLOCK=$(sudo lsblk --paths|awk '/14G/ {print $1}'| head -1) + tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only + + - name: deploy cluster + run: tests/scripts/github-action-helper.sh deploy_cluster + + - name: wait for prepare pod + run: tests/scripts/github-action-helper.sh wait_for_prepare_pod + + - name: wait for ceph to be ready + run: tests/scripts/github-action-helper.sh wait_for_ceph_to_be_ready osd 1 + + - name: check-ownerreferences + run: tests/scripts/github-action-helper.sh check_ownerreferences + + - name: collect common logs + if: always() + uses: ./.github/workflows/collect-logs + with: + name: canary + + - name: setup tmate session for debugging when event is PR + if: failure() && github.event_name == 'pull_request' + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 60 + + two-osds-in-device: + runs-on: ubuntu-18.04 + if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')" + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: setup cluster resources + uses: ./.github/workflows/setup-cluster-resources + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: validate-yaml + run: tests/scripts/github-action-helper.sh validate_yaml + + - name: use local disk as OSD + run: | + tests/scripts/github-action-helper.sh use_local_disk + BLOCK=$(sudo lsblk --paths|awk '/14G/ {print $1}'| head -1) + tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only + + - name: deploy cluster + run: tests/scripts/github-action-helper.sh deploy_cluster two_osds_in_device + + - name: wait for prepare pod + run: tests/scripts/github-action-helper.sh wait_for_prepare_pod + + - name: wait for ceph to be ready + run: tests/scripts/github-action-helper.sh wait_for_ceph_to_be_ready osd 2 + + - name: check-ownerreferences + run: tests/scripts/github-action-helper.sh check_ownerreferences + + - name: collect common logs + if: always() + uses: ./.github/workflows/collect-logs + with: + name: canary + + - name: setup tmate session for debugging when event is PR + if: failure() && github.event_name == 'pull_request' + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 60 + pvc: runs-on: ubuntu-18.04 if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')" diff --git a/tests/scripts/create-bluestore-partitions.sh b/tests/scripts/create-bluestore-partitions.sh index e06001892..b5c7adbd7 100755 --- a/tests/scripts/create-bluestore-partitions.sh +++ b/tests/scripts/create-bluestore-partitions.sh @@ -37,6 +37,12 @@ function usage { function wipe_disk { sudo sgdisk --zap-all -- "$DISK" sudo dd if=/dev/zero of="$DISK" bs=1M count=10 + if [ -n "$WIPE_ONLY" ]; then + # `parted "$DISK -s print" exits with 1 if the partition label doesn't exist. + # It's no problem in "--wipe-only" mode + sudo parted "$DISK" -s print || : + return + fi sudo parted -s "$DISK" mklabel gpt sudo partprobe "$DISK" sudo udevadm settle @@ -82,6 +88,9 @@ while [ "$1" != "" ]; do shift OSD_COUNT="$1" ;; + --wipe-only) + WIPE_ONLY=1 + ;; -h | --help) usage exit @@ -96,22 +105,29 @@ done # First wipe the disk wipe_disk -if [ -n "$BLUESTORE_TYPE" ]; then - case "$BLUESTORE_TYPE" in - block.db) - create_partition block.db - ;; - block.wal) - create_partition block.db - create_partition block.wal - ;; - *) - printf "invalid bluestore configuration %q" "$BLUESTORE_TYPE" >&2 - exit 1 - esac +if [ -n "$WIPE_ONLY" ]; then + exit +fi + +if [ -z "$WIPE_ONLY" ]; then + if [ -n "$BLUESTORE_TYPE" ]; then + case "$BLUESTORE_TYPE" in + block.db) + create_partition block.db + ;; + block.wal) + create_partition block.db + create_partition block.wal + ;; + *) + printf "invalid bluestore configuration %q" "$BLUESTORE_TYPE" >&2 + exit 1 + esac + fi + + # Create final block partitions + create_block_partition "$OSD_COUNT" fi -# Create final block partitions -create_block_partition "$OSD_COUNT" # Inform the kernel of partition table changes sudo partprobe "$DISK" diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index 6f58dfef9..156666e37 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -208,7 +208,11 @@ function replace_ceph_image() { function deploy_cluster() { cd deploy/examples deploy_manifest_with_local_build operator.yaml - sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\/}|g" cluster-test.yaml + if [ $# == 0 ]; then + sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\/}|g" cluster-test.yaml + elif [ "$1" = "two_osds_in_device" ] ; then + sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\/}\n config:\n osdsPerDevice: \"2\"|g" cluster-test.yaml + fi kubectl create -f cluster-test.yaml kubectl create -f object-test.yaml kubectl create -f pool-test.yaml