[libvirt PATCH v2 1/5] ci: Separate the integration job template to a separate file

Erik Skultety eskultet at redhat.com
Thu May 12 08:50:55 UTC 2022


Future patches will do more code extraction from the existing template
using YAML anchors so it'd be better that the templates would live
separately from job definitions.

Signed-off-by: Erik Skultety <eskultet at redhat.com>
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
---
 ci/integration-template.yml | 52 +++++++++++++++++++++++++++++++++++
 ci/integration.yml          | 54 ++-----------------------------------
 2 files changed, 54 insertions(+), 52 deletions(-)
 create mode 100644 ci/integration-template.yml

diff --git a/ci/integration-template.yml b/ci/integration-template.yml
new file mode 100644
index 0000000000..c4201df6db
--- /dev/null
+++ b/ci/integration-template.yml
@@ -0,0 +1,52 @@
+.integration_tests:
+  stage: integration_tests
+  before_script:
+    - mkdir "$SCRATCH_DIR"
+    - 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
+    - sudo dnf install -y libvirt-rpms/* libvirt-perl-rpms/*
+    - sudo pip3 install --prefix=/usr avocado-framework
+    - 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 virtlogd virtlockd";
+      else
+        DAEMONS="virtproxyd virtqemud virtinterfaced virtsecretd virtstoraged virtnwfilterd virtnodedevd virtlogd virtlockd";
+      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;
+  script:
+    - mkdir logs
+    - 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
+  after_script:
+    - test "$CI_JOB_STATUS" = "success" && exit 0;
+    - test -e "$SCRATCH_DIR"/avocado && sudo mv "$SCRATCH_DIR"/avocado/latest/test-results logs/avocado;
+    - sudo coredumpctl info --no-pager > logs/coredumpctl.txt
+    - sudo mv /var/log/libvirt logs/libvirt
+    - sudo chown -R $(whoami):$(whoami) logs
+      # rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type
+    - find logs/avocado/ -type f ! -name "*.log" -exec
+        sh -c 'DIR=$(dirname {}); NAME=$(basename {}); mv $DIR/$NAME{,.log}' \;
+  variables:
+    SCRATCH_DIR: "/tmp/scratch"
+  artifacts:
+    name: logs
+    paths:
+      - logs
+    when: on_failure
+  rules:
+    - if: '$LIBVIRT_CI_INTEGRATION'
+      when: on_success
+    - when: never
diff --git a/ci/integration.yml b/ci/integration.yml
index 17f20b3945..a71df41694 100644
--- a/ci/integration.yml
+++ b/ci/integration.yml
@@ -1,55 +1,5 @@
-.integration_tests:
-  stage: integration_tests
-  before_script:
-    - mkdir "$SCRATCH_DIR"
-    - 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
-    - sudo dnf install -y libvirt-rpms/* libvirt-perl-rpms/*
-    - sudo pip3 install --prefix=/usr avocado-framework
-    - 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 virtlogd virtlockd";
-      else
-        DAEMONS="virtproxyd virtqemud virtinterfaced virtsecretd virtstoraged virtnwfilterd virtnodedevd virtlogd virtlockd";
-      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;
-  script:
-    - mkdir logs
-    - 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
-  after_script:
-    - test "$CI_JOB_STATUS" = "success" && exit 0;
-    - test -e "$SCRATCH_DIR"/avocado && sudo mv "$SCRATCH_DIR"/avocado/latest/test-results logs/avocado;
-    - sudo coredumpctl info --no-pager > logs/coredumpctl.txt
-    - sudo mv /var/log/libvirt logs/libvirt
-    - sudo chown -R $(whoami):$(whoami) logs
-      # rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type
-    - find logs/avocado/ -type f ! -name "*.log" -exec
-        sh -c 'DIR=$(dirname {}); NAME=$(basename {}); mv $DIR/$NAME{,.log}' \;
-  variables:
-    SCRATCH_DIR: "/tmp/scratch"
-  artifacts:
-    name: logs
-    paths:
-      - logs
-    when: on_failure
-  rules:
-    - if: '$LIBVIRT_CI_INTEGRATION'
-      when: on_success
-    - when: never
+include:
+  - 'ci/integration-template.yml'
 
 centos-stream-8-tests:
   extends: .integration_tests
-- 
2.34.3



More information about the libvir-list mailing list