From 7536b6ce100930d7d2c644ce0d4e43a9596ec5df Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 6 Dec 2022 13:29:16 -0800 Subject: [PATCH] ostree_build: tee and timestamp the `rpm-ostree` output Instead of just redirecting it to a log file, let's tee it, so simple errors can be read off a screenshot without bothering to download the file. Also, let's timestamp it (via `ts` from moreutils) so we can see which bits of it take a long time... Signed-off-by: Adam Williamson --- tests/_ostree_build.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/_ostree_build.pm b/tests/_ostree_build.pm index b746d870..0e33b8b7 100644 --- a/tests/_ostree_build.pm +++ b/tests/_ostree_build.pm @@ -33,7 +33,7 @@ sub run { # usually a good idea for this kinda thing assert_script_run "setenforce Permissive"; # install the tools we need - assert_script_run "dnf -y install git lorax flatpak ostree rpm-ostree wget dbus-daemon", 300; + assert_script_run "dnf -y install git lorax flatpak ostree rpm-ostree wget dbus-daemon moreutils", 300; # now check out workstation-ostree-config assert_script_run 'git clone https://pagure.io/workstation-ostree-config.git'; assert_script_run 'pushd workstation-ostree-config'; @@ -49,6 +49,9 @@ sub run { # now make the ostree repo assert_script_run "mkdir -p /var/tmp/ostree"; assert_script_run "ostree --repo=/var/tmp/ostree/repo init --mode=archive"; + # need this to make the pipeline in the next command fail when + # rpm-ostree fails. note: this is a bashism + assert_script_run "set -o pipefail"; # PULL SOME LEVERS! PULL SOME LEVERS! # This shadows pungi/ostree/tree.py # FIXME: when https://fedoraproject.org/wiki/Changes/FedoraSilverblueUnifiedCore @@ -57,7 +60,8 @@ sub run { # disables updating the ref with the new commit, and we *do* want # to do that. pungi updates the ref itself, I don't want to copy # all that work in here - assert_script_run "rpm-ostree compose tree --repo=/var/tmp/ostree/repo/ --add-metadata-string=version=${advortask} --force-nocache /workstation-ostree-config/fedora-$lcsubv.yaml > /tmp/ostree.log 2>&1", 4500; + assert_script_run "rpm-ostree compose tree --repo=/var/tmp/ostree/repo/ --add-metadata-string=version=${advortask} --force-nocache /workstation-ostree-config/fedora-$lcsubv.yaml |& ts " . '[%Y-%m-%d %H:%M:%S]' . " | tee /tmp/ostree.log", 4500; + assert_script_run "set +o pipefail"; upload_logs "/tmp/ostree.log"; # check out the ostree installer lorax templates assert_script_run 'cd /';