[libvirt PATCH v2 3/8] ci: integration: Extract several hidden job definitions to a script

Erik Skultety eskultet at redhat.com
Fri Jan 27 09:26:51 UTC 2023


This will allow us to re-use the script in other scenarios like local
executions where up until now one had to copy-paste the recipe
line-by-line.

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 ci/integration-template.yml | 36 +-----------------------------------
 ci/integration.sh           | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 35 deletions(-)
 create mode 100644 ci/integration.sh

diff --git a/ci/integration-template.yml b/ci/integration-template.yml
index 15c36d7a29..802cba9420 100644
--- a/ci/integration-template.yml
+++ b/ci/integration-template.yml
@@ -27,34 +27,6 @@
 .install-deps: &install-deps
   - sudo dnf install -y libvirt-rpms/* libvirt-perl-rpms/* libvirt-python-rpms/*
 
-  # Avocado >98.0 fails with the nwfilter TCK tests, so stick with 98.0 for now
-  - sudo pip3 install --prefix=/usr avocado-framework==98.0
-
-
-.enable-core-dumps: &enable-core-dumps
-  - sudo sh -c "echo DefaultLimitCORE=infinity >> /etc/systemd/system.conf" # Explicitly allow storing cores globally
-  - sudo systemctl daemon-reexec # need to reexec systemd after changing config
-
-
-.enable-libvirt-debugging: &enable-libvirt-debugging
-  - source /etc/os-release  # in order to query the vendor-provided variables
-  - if test "$ID" = "centos" && test "$VERSION_ID" -lt 9 ||
-       test "$ID" = "fedora" && test "$VERSION_ID" -lt 35;
-    then
-      DAEMONS="libvirtd virtlockd virtlogd";
-    else
-      DAEMONS="virtinterfaced virtlockd virtlogd virtnetworkd virtnodedevd virtnwfilterd virtproxyd virtqemud virtsecretd virtstoraged";
-    fi
-  - for daemon in $DAEMONS;
-    do
-      LOG_OUTPUTS="1:file:/var/log/libvirt/${daemon}.log";
-      LOG_FILTERS="3:remote 4:event 3:util.json 3:util.object 3:util.dbus 3:util.netlink 3:node_device 3:rpc 3:access 1:*";
-      sudo augtool set /files/etc/libvirt/${daemon}.conf/log_filters "'$LOG_FILTERS'" &>/dev/null;
-      sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs "'$LOG_OUTPUTS'" &>/dev/null;
-      sudo systemctl --quiet stop ${daemon}.service;
-      sudo systemctl restart ${daemon}.socket;
-    done
-
 
 .collect-logs: &collect-logs
   - set +e
@@ -79,14 +51,8 @@
   before_script:
     - mkdir "$SCRATCH_DIR"
     - *install-deps
-    - *enable-core-dumps
-    - *enable-libvirt-debugging
-    - sudo virsh net-start default &>/dev/null || true;
   script:
-    - cd "$SCRATCH_DIR"
-    - git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git
-    - cd libvirt-tck
-    - sudo avocado --config avocado.config run --job-results-dir "$SCRATCH_DIR"/avocado
+    - chmod +x ci/integration.sh && ci/integration.sh
   after_script:
     - test "$CI_JOB_STATUS" = "success" && exit 0;
     - *collect-logs
diff --git a/ci/integration.sh b/ci/integration.sh
new file mode 100644
index 0000000000..21795518c3
--- /dev/null
+++ b/ci/integration.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Avocado >98.0 fails with the nwfilter TCK tests, so stick with 98.0 for now
+sudo pip3 install --prefix=/usr avocado-framework==98.0
+
+sudo sh -c "echo DefaultLimitCORE=infinity >> /etc/systemd/system.conf" # Explicitly allow storing cores globally
+sudo systemctl daemon-reexec # need to reexec systemd after changing config
+
+source /etc/os-release  # in order to query the vendor-provided variables
+if test "$ID" = "centos" && test "$VERSION_ID" -lt 9 ||
+   test "$ID" = "fedora" && test "$VERSION_ID" -lt 35
+then
+    DAEMONS="libvirtd virtlockd virtlogd"
+else
+    DAEMONS="virtinterfaced virtlockd virtlogd virtnetworkd virtnodedevd virtnwfilterd virtproxyd virtqemud virtsecretd virtstoraged"
+fi
+for daemon in $DAEMONS
+do
+    LOG_OUTPUTS="1:file:/var/log/libvirt/${daemon}.log"
+    LOG_FILTERS="3:remote 4:event 3:util.json 3:util.object 3:util.dbus 3:util.netlink 3:node_device 3:rpc 3:access 1:*"
+    sudo augtool set /files/etc/libvirt/${daemon}.conf/log_filters "'$LOG_FILTERS'" &>/dev/null
+    sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs "'$LOG_OUTPUTS'" &>/dev/null
+    sudo systemctl --quiet stop ${daemon}.service
+    sudo systemctl restart ${daemon}.socket
+done
+
+sudo virsh net-start default &>/dev/null || true
+
+cd "$SCRATCH_DIR"
+git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git
+cd libvirt-tck
+sudo avocado --config avocado.config run --job-results-dir "$SCRATCH_DIR"/avocado
-- 
2.39.1



More information about the libvir-list mailing list