yocto-autobuilder-helper/scripts/collect-results
Peter Marko 106846c55e scripts/collect-results: add cve-update logs for metrics
CVE update is currently not working properly on autobuilder.
Add db update logs to build results for problem analysis.

The globs are necessary as:
* there can be different host archs
* there are different db sources (nvd/fkie and nvd2)
* db update version is irrelevant and glob is future proof
* ther are multiple bitbake runs (metrics for core and oe)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-09-23 13:48:19 +01:00

64 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright Linux Foundation, Richard Purdie
#
WORKDIR=$1
DEST=$2
target=$3
if [ -e $WORKDIR/tmp/log/oeqa/ ] && [ -n "$(ls -A "$WORKDIR/tmp/log/oeqa/")" ]; then
mkdir -p $DEST
cp -Lrf $WORKDIR/tmp/log/oeqa/ $DEST/$target
fi
if [ -e $WORKDIR/tmp/log/oeqa-artefacts/ ] && [ -n "$(ls -A "$WORKDIR/tmp/log/oeqa-artefacts/")" ]; then
mkdir -p $DEST/../artefacts/
cp -Lrf $WORKDIR/tmp/log/oeqa-artefacts/ $DEST/../artefacts/$target
fi
if [ -e $WORKDIR/buildhistory ]; then
# ab-fetchrev tag set in buildhistory-init
if [ $(git -C $WORKDIR/buildhistory tag -l "ab-fetchrev") ]; then
mkdir -p $DEST/$target
$WORKDIR/../scripts/buildhistory-diff -p $WORKDIR/buildhistory ab-fetchrev > $DEST/$target/buildhistory.txt
fi
fi
case "$target" in
"metrics")
mkdir -p $DEST/$target/db-update
# there are multiple logs (for core and oe bitbake runs)
cp -f $WORKDIR/tmp/work/*/cve-update-*-native/*/temp/log.do_fetch.* $DEST/$target/db-update/ || true
;;
esac
HSFILE=$WORKDIR/tmp/buildstats/*/host_stats*
d="intermittent_failure_host_data"
step_i=1
step_f=1
for f in $HSFILE; do
if [ -e $f ]; then
if [ ! -e $DEST/$target/$d ]; then
mkdir -p $DEST/$target/$d
fi
cp $f $DEST/$target/$d
if [[ "$f" == *"failure"* ]] ; then
mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_f}.txt
step_f=$((step_f+1))
continue
fi
grep -m 1 "^top -" $f
if [ $? -eq 0 ]; then
mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_i}_top.txt
else
mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_i}.txt
fi
step_i=$((step_i+1))
fi
done