Skip to contentSkip to conversation

travis: update the kernel and reboot before running the suite

PATCH In review Ondrej Mosnacek 1 participant 2 messages Oct 21, 2020 – Oct 23, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 travis: update the kernel and reboot before running the suite

While the stable release cloud image always ships with a kernel which has the matching -modules and -devel packages available in the "fedora" repo, on development releases the nightly images may be behind the latest repo content and thus may fail to install kernel-modules and kernel-devel.

Fix it by installing the latest available the kernel and booting it before running the testsuite. This unfortunately adds around 3-4 minutes to the Travis build time, but there seems to be no better way to make the Rawhide test work.

---
 .travis.yml               |  1 +
 travis-ci/run-kvm-test.sh | 12 ++++++++++++
 2 files changed, 13 insertions(+)
.travis.yml +1 -0
index 9488807..dcac54d 100644
@@ -17,6 +17,7 @@ addons:
       - bridge-utils
       - libguestfs-tools
       - cpu-checker
+      - netcat
 
 before_install:
   # FYI: known good with HEAD at 8551fc60fc515cd290ba38ee8c758c1f4df52b56
travis-ci/run-kvm-test.sh +12 -0
index 70fcf08..d22c92b 100755
@@ -120,5 +120,17 @@ fi
 # our known_hosts. Also, we need to forward the project directory
 # so forks know where to go.
 #
+
+# First update to the latest kernel.
+ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" \
+    dnf install -y kernel
+
+# Then reboot.
+sudo virsh reboot fedoravm
+sleep 5
+
+while ! nc -w 10 -z "$ipaddy" 22; do sleep 0.5s; done
+
+# And run the testsuite.
 project_dir="$(basename "$TRAVIS_BUILD_DIR")"
 ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" "SELINUX_DIR=/root/$project_dir /root/$project_dir/$TEST_RUNNER"
Signature · 1 line
2.26.2
#1 lore raw
Quoted 52 lines · Ondrej Mosnacek

While the stable release cloud image always ships with a kernel which has the matching -modules and -devel packages available in the "fedora" repo, on development releases the nightly images may be behind the latest repo content and thus may fail to install kernel-modules and kernel-devel.

Fix it by installing the latest available the kernel and booting it before running the testsuite. This unfortunately adds around 3-4 minutes to the Travis build time, but there seems to be no better way to make the Rawhide test work.

---
 .travis.yml               |  1 +
 travis-ci/run-kvm-test.sh | 12 ++++++++++++
 2 files changed, 13 insertions(+)
.travis.yml +1 -0
index 9488807..dcac54d 100644
@@ -17,6 +17,7 @@ addons:
       - bridge-utils
       - libguestfs-tools
       - cpu-checker
+      - netcat
 
 before_install:
   # FYI: known good with HEAD at 8551fc60fc515cd290ba38ee8c758c1f4df52b56
travis-ci/run-kvm-test.sh +12 -1
index 70fcf08..d22c92b 100755
@@ -120,5 +120,17 @@ fi
 # our known_hosts. Also, we need to forward the project directory
 # so forks know where to go.
 #
+
+# First update to the latest kernel.
+ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" \
+    dnf install -y kernel
+
+# Then reboot.
+sudo virsh reboot fedoravm
+sleep 5
+
+while ! nc -w 10 -z "$ipaddy" 22; do sleep 0.5s; done
+
+# And run the testsuite.
 project_dir="$(basename "$TRAVIS_BUILD_DIR")"
 ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" "SELINUX_DIR=/root/$project_dir /root/$project_dir/$TEST_RUNNER"
--
Quoted 1 line

2.26.2

I went ahead and applied this one as well so that we have a fully working CI again:
https://github.com/SELinuxProject/selinux-testsuite/commit/596f1f174be32236f80d26c686244f78791b565a

Signature · 3 lines
Ondrej Mosnacek
Software Engineer, Platform Security - SELinux kernel
Red Hat, Inc.