[libvirt PATCH v3 10/12] ci: jobs.sh: integration: Execute commands via 'run_cmd[_quiet]' helpers

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

 



Unfortunately, once we go down the line of running our own scripts as
part of GitLab CI jobs rather than open coding Shell in YAML, we lose
the benefit of seeing each line the script executes. The downside of
the default YAML however is that we have to maintain the same piece of
code on 2 places in that case. Let's adopt what we use with other
container jobs and prefix each shell command with 'run_cmd' or
'run_cmd_quiet' which will dump it in the logs before executing.
Flow control expressions and structures are a problem though in this
regard, so let's just print some important values for debugging
purposes.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 ci/jobs.sh | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/ci/jobs.sh b/ci/jobs.sh
index 8ae3b87228..861e561039 100644
--- a/ci/jobs.sh
+++ b/ci/jobs.sh
@@ -87,16 +87,16 @@ run_website_build() {
 }
 
 run_integration() {
-    sudo pip3 install --prefix=/usr avocado-framework
+    run_cmd sudo pip3 install --prefix=/usr avocado-framework
 
     # Explicitly allow storing cores globally
-    sudo sh -c "echo DefaultLimitCORE=infinity >> /etc/systemd/system.conf"
+    run_cmd sudo sh -c "echo DefaultLimitCORE=infinity >> /etc/systemd/system.conf"
 
     # Need to reexec systemd after changing config
-    sudo systemctl daemon-reexec
+    run_cmd sudo systemctl daemon-reexec
 
     # Source the os-release file to query the vendor-provided variables
-    . /etc/os-release
+    run_cmd . /etc/os-release
     if test "$ID" = "centos" && test "$VERSION_ID" -eq 8
     then
         DAEMONS="libvirtd virtlockd virtlogd"
@@ -107,10 +107,10 @@ run_integration() {
     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'" 1>/dev/null 2>&1
-        sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs "'$LOG_OUTPUTS'" 1>/dev/null 2>&1
-        sudo systemctl --quiet stop ${daemon}.service
-        sudo systemctl restart ${daemon}.socket
+        run_cmd_quiet sudo augtool set /files/etc/libvirt/${daemon}.conf/log_filters "'$LOG_FILTERS'"
+        run_cmd_quiet sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs "'$LOG_OUTPUTS'"
+        run_cmd_quiet sudo systemctl --quiet stop ${daemon}.service
+        run_cmd_quiet sudo systemctl restart ${daemon}.socket
     done
 
     # Make sure the default network is started on all platforms
@@ -118,10 +118,10 @@ run_integration() {
     # Shell scripts with -e by default and virsh returns an error if one tries
     # to start a machine/network that is already active which is both fine and
     # should also be a non-fatal error
-    sudo virsh --quiet net-start default 1>/dev/null 2>&1 || true
+    run_cmd_quiet sudo virsh --quiet net-start default || 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
+    run_cmd cd "$SCRATCH_DIR"
+    run_cmd git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git
+    run_cmd cd libvirt-tck
+    run_cmd 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