Skip to content

Commit ae099f5

Browse files
MaisenbacherDigaw
authored andcommitted
CI: adopt kubevirt-action for self-hosted ARC
Previously we used two independent ARC deployments where one compiled/announced the kernel and the second spun up a VM that executed our tests. This setup caused concurrency related issues in other projects that use the same infrastructure. An ARC can assign work to any available resource (in our case the VM) and thus we could not guaranty which kernel was used for testing. We are now using a single ARC that can build and spawn a VM. To spawn and run commands in the VM we are now using the kubevirt-action defined in linux-blktests/blktests-ci. Signed-off-by: Dennis Maisenbacher <[email protected]>
1 parent d907d7e commit ae099f5

File tree

1 file changed

+72
-72
lines changed

1 file changed

+72
-72
lines changed

.github/workflows/run-nightly-tests.yml

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -7,80 +7,80 @@ on:
77
- cron: '0 01 * * *'
88

99
jobs:
10-
request-kernel-version:
11-
if: github.repository == 'linux-nvme/nvme-cli'
12-
runs-on: ubuntu-latest
13-
steps:
14-
#We don't have to build the kernel here, as we have a cron job running on
15-
#the k8s cluster that builds this target nightly.
16-
- name: Request nightly Linus' master tree kernel build for the next job
17-
run: |
18-
echo "KERNEL_VERSION=linus-master" >> $GITHUB_ENV
19-
- name: Notifying the next job to pick up the correct kernel tag
20-
run: |
21-
echo "${KERNEL_VERSION}"
2210
nightly-tests:
2311
if: github.repository == 'linux-nvme/nvme-cli'
24-
runs-on: arc-vm-runner-set
25-
needs: request-kernel-version
26-
container:
27-
image: ghcr.io/linux-nvme/debian.python:latest
28-
#Expose all devices to the container through the `privileged` flag.
29-
#
30-
#BDEV0 is an environment variable of the self-hosted runner instance
31-
#that contains a valid nvme namespace which is capable of the nvm
32-
#command set.
33-
options: '--privileged -v "/dev":"/dev":z -e BDEV0'
12+
runs-on: arc-vm-nvme-cli
3413
steps:
35-
- name: Output kernel version
36-
run: |
37-
uname -a
3814
- uses: actions/checkout@v4
39-
- name: Install dependencies
40-
run: |
41-
PIPX_BIN_DIR=/usr/local/bin pipx install nose2 --force
42-
- name: Build and install nvme-cli
43-
run: |
44-
scripts/build.sh -b release -c gcc
45-
- name: Overwrite test config
46-
run: |
47-
CONTROLLER=$(echo ${BDEV0} | sed 's/n[0-9]*$//')
48-
cat > tests/config.json << EOF
49-
{
50-
"controller" : "$CONTROLLER",
51-
"ns1": "${BDEV0}",
52-
"log_dir": "tests/nvmetests/",
53-
"nvme_bin": "$(pwd)/.build-ci/nvme"
54-
}
55-
EOF
56-
cat tests/config.json
57-
- name: Run on device tests
58-
run: |
59-
nose2 --verbose --start-dir tests \
60-
nvme_attach_detach_ns_test \
61-
nvme_compare_test \
62-
nvme_copy_test \
63-
nvme_create_max_ns_test \
64-
nvme_ctrl_reset_test \
65-
nvme_dsm_test \
66-
nvme_error_log_test \
67-
nvme_flush_test \
68-
nvme_format_test \
69-
nvme_fw_log_test \
70-
nvme_get_features_test \
71-
nvme_get_lba_status_test \
72-
nvme_id_ctrl_test \
73-
nvme_id_ns_test \
74-
nvme_lba_status_log_test \
75-
nvme_read_write_test \
76-
nvme_smart_log_test \
77-
nvme_verify_test \
78-
nvme_writeuncor_test \
79-
nvme_writezeros_test
80-
- name: Upload logs
81-
uses: actions/upload-artifact@v4
82-
if: always()
8315
with:
84-
name: nvme-cli-test-logs
85-
path: |
86-
./tests/nvmetests/**/*.log
16+
repository: "linux-blktests/blktests-ci"
17+
#We don't have to build the kernel here, as we have a cron job running on
18+
#the k8s cluster that builds the linus-master target nightly.
19+
- name: Run in VM
20+
uses: ./.github/actions/kubevirt-action
21+
with:
22+
kernel_version: linus-master
23+
vm_artifact_upload_dir: nvme-cli/tests/nvmetests/
24+
run_cmds: |
25+
#Preventing bash variable expension for the outer cat by using
26+
#single quotes around EOF
27+
cat > test.sh << 'EOF'
28+
#!/bin/bash
29+
set -e
30+
set -x
31+
uname -a
32+
PIPX_BIN_DIR=/usr/local/bin pipx install nose2 --force
33+
git clone https://github.com/${{ github.repository }} /nvme-cli
34+
cd /nvme-cli
35+
scripts/build.sh -b release -c gcc
36+
CONTROLLER=$(echo "${BDEV0}" | sed 's/n[0-9]*$//')
37+
cat > tests/config.json << EOJ
38+
{
39+
"controller" : "${CONTROLLER}",
40+
"ns1": "${BDEV0}",
41+
"log_dir": "tests/nvmetests/",
42+
"nvme_bin": "/nvme-cli/.build-ci/nvme"
43+
}
44+
EOJ
45+
cat tests/config.json
46+
47+
nose2 --verbose --start-dir tests \
48+
nvme_attach_detach_ns_test \
49+
nvme_compare_test \
50+
nvme_copy_test \
51+
nvme_create_max_ns_test \
52+
nvme_ctrl_reset_test \
53+
nvme_dsm_test \
54+
nvme_error_log_test \
55+
nvme_flush_test \
56+
nvme_format_test \
57+
nvme_fw_log_test \
58+
nvme_get_features_test \
59+
nvme_get_lba_status_test \
60+
nvme_id_ctrl_test \
61+
nvme_id_ns_test \
62+
nvme_lba_status_log_test \
63+
nvme_read_write_test \
64+
nvme_smart_log_test \
65+
nvme_verify_test \
66+
nvme_writeuncor_test \
67+
nvme_writezeros_test
68+
EOF
69+
70+
sudo chmod +x test.sh
71+
72+
#Create shared volume mount point for artifact upload
73+
mkdir nvme-cli
74+
75+
#Expose all devices to the container through the `privileged` flag.
76+
#
77+
#BDEV0 is an environment variable of the self-hosted runner instance
78+
#that contains a valid nvme namespace which is capable of the nvm
79+
#command set.
80+
81+
sudo docker run --privileged \
82+
-v "/dev":"/dev":z \
83+
-e BDEV0 \
84+
-v "${PWD}/test.sh":"/test.sh" \
85+
-v "${PWD}/nvme-cli":"/nvme-cli":z \
86+
ghcr.io/linux-nvme/debian.python:latest /test.sh

0 commit comments

Comments
 (0)