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' 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(a)redhat.com>
---
ci/jobs.sh | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/ci/jobs.sh b/ci/jobs.sh
index 3a89cb1a69..27add3d105 100644
--- a/ci/jobs.sh
+++ b/ci/jobs.sh
@@ -82,16 +82,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" # Explicitly allow storing cores globally
# Need to reexec systemd after changing config
- sudo systemctl daemon-reexec
+ run_cmd sudo systemctl daemon-reexec # need to reexec systemd after changing config
# 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"
@@ -102,10 +102,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'" 2>/dev/null 1>&2
- sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs
"'$LOG_OUTPUTS'" 2>/dev/null 1>&2
- sudo systemctl --quiet stop ${daemon}.service
- sudo systemctl restart ${daemon}.socket
+ run_cmd sudo augtool set /files/etc/libvirt/${daemon}.conf/log_filters
"'$LOG_FILTERS'" "2>/dev/null 1>&2"
+ run_cmd sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs
"'$LOG_OUTPUTS'" "2>/dev/null 1>&2"
+ run_cmd sudo systemctl --quiet stop ${daemon}.service
+ run_cmd sudo systemctl restart ${daemon}.socket
done
# Make sure the default network is started on all platforms
@@ -113,10 +113,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 2>/dev/null 1>&2 || true
+ run_cmd sudo virsh --quiet net-start default "2>/dev/null 1>&2"
|| 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