[libvirt PATCH 02/12] ci: integration: Extract the integration CI main recipe to jobs.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Follow what's been done to other jobs in .gitlab-ci.yml and extract the
shell logic from YAML to a function in ci/jobs.sh

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 ci/integration-template.yml | 36 ++----------------------------------
 ci/jobs.sh                  | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/ci/integration-template.yml b/ci/integration-template.yml
index 111a115286..e87ffaf9aa 100644
--- a/ci/integration-template.yml
+++ b/ci/integration-template.yml
@@ -27,33 +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
-
-
-.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;
-    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
@@ -78,14 +51,9 @@
   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
+    - source ci/jobs.sh
+    - run_integration
   after_script:
     - test "$CI_JOB_STATUS" = "success" && exit 0;
     - *collect-logs
diff --git a/ci/jobs.sh b/ci/jobs.sh
index eb4a4e29cf..2bc6f86e45 100644
--- a/ci/jobs.sh
+++ b/ci/jobs.sh
@@ -80,3 +80,35 @@ run_website_build() {
 
     run_build
 }
+
+run_integration() {
+    # Avocado >98.0 fails with the nwfilter TCK tests, so stick with 98.0 for now
+    sudo pip3 install --prefix=/usr avocado-framework
+
+    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
+    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.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux