]> xenbits.xensource.com Git - libvirt.git/commitdiff
ci: integration: Extract the integration CI main recipe to jobs.sh
authorErik Skultety <eskultet@redhat.com>
Fri, 15 Sep 2023 12:23:21 +0000 (14:23 +0200)
committerErik Skultety <eskultet@redhat.com>
Tue, 19 Sep 2023 11:35:58 +0000 (13:35 +0200)
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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ci/integration-template.yml
ci/jobs.sh

index 111a1152863ab40a4ef50d5e46a31cf9272ad980..e87ffaf9aa1ff8fea039d71b5f9f160248d41dbd 100644 (file)
 .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
   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
index eb4a4e29cf3d5c5935731c0f5c718ebc7cf9793b..2bc6f86e450784116abb81272976fb4c55033508 100644 (file)
@@ -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
+}