diff --git a/.packit.yaml b/.packit.yaml index ae01a7f..037e8e0 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -4,9 +4,12 @@ jobs: trigger: pull_request targets: - fedora-all - - epel-7 - - epel-8 - - epel-9 + - epel-7-x86_64 + - epel-7-aarch64 + - epel-8-x86_64 + - epel-8-aarch64 + - epel-9-x86_64 + - epel-9-aarch64 # - job: copr_build # trigger: commit # branch: main diff --git a/mini-tps.spec b/mini-tps.spec index 9966a6e..8334fb6 100644 --- a/mini-tps.spec +++ b/mini-tps.spec @@ -1,6 +1,6 @@ Name: mini-tps Version: 0.1 -Release: 166%{?dist} +Release: 167%{?dist} Summary: Mini TPS - Test Package Sanity License: GPLv2 @@ -64,6 +64,9 @@ install -pD -m 0755 profiles/fedora/prepare-system %{buildroot}%{_libexecdir}/mi %changelog +* Thu Jan 25 2024 Jiri Popelka - 0.1-167 +- mtps-get-module improvements + * Fri Jan 19 2024 Jiri Popelka - 0.1-166 - Skip update if old package can't be installed - Separate exit code for skipped tests diff --git a/mtps-get-module b/mtps-get-module index c730695..4375500 100755 --- a/mtps-get-module +++ b/mtps-get-module @@ -21,6 +21,7 @@ if [ -z "${YUMDNFCMD:-}" ]; then source "$(dirname "${BASH_SOURCE[0]}")/mtps-set RET_NO_RPMS_IN_BREW=7 RET_NO_RPMS_IN_REPOS=8 +RET_NO_MODULE_ARCH=9 builds_from_answer() { local xml="$1" && shift @@ -174,6 +175,17 @@ mk_url_mmd() { echo "$url" } +url_exists() { + local url="$1" && shift + response=$(curl --silent --head "$url" | grep HTTP) + if [[ $response != *" 404 "* && $response != *" 403 "* ]]; then + return 0 + else + echo "$url does not exist" + return 1 + fi +} + download_artifact() { local url="$1" && shift local dstdir="$1" && shift @@ -373,11 +385,43 @@ while [[ $# -gt 0 ]]; do done mkdir -p "${LOGS_DIR:=mtps-logs}" -TESTRUN_ID="$(date +%H%M%S)" -logfname="${LOGS_DIR%%/}/${TESTRUN_ID}-mtps-get-module.log" +LOGS_DIR="$(realpath "$LOGS_DIR")" +while true; do + TESTRUN_ID="$(date +%H%M%S)" + logfname="${LOGS_DIR%%/}/${TESTRUN_ID}-${MBSID}-mtps-get-module.log" + logfname_skip="$(dirname "$logfname")/SKIP-$(basename "$logfname")" + logfname_pass="$(dirname "$logfname")/PASS-$(basename "$logfname")" + logfname_fail="$(dirname "$logfname")/FAIL-$(basename "$logfname")" + if [[ -e "$logfname" || -e "$logfname_pass" || -e "$logfname_fail" ]]; then + sleep 1 + continue + fi + break +done exec &> >(tee -a "$logfname") exec 2>&1 +do_clean_exit() { + rc=$? + trap - SIGINT SIGTERM SIGABRT EXIT # clear the trap + new_logfname="$logfname_fail" + if [[ "$rc" -eq 0 ]]; then + new_logfname="$logfname_pass" + elif [[ "$rc" -eq $RET_NO_RPMS_IN_BREW || "$rc" -eq $RET_NO_RPMS_IN_REPOS || "$rc" -eq $RET_NO_MODULE_ARCH ]]; then + new_logfname="$logfname_skip" + fi + # Close tee pipes + for pid in $(ps -o pid --no-headers --ppid $$); do + if [ -n "$(ps -p $pid -o pid=)" ]; then + kill -s HUP $pid + fi + done + mv -f "$logfname" "$new_logfname" + exit $rc +} + +trap do_clean_exit SIGINT SIGTERM SIGABRT EXIT + debug "Brew build: $BUILD" debug "Brew tag: $TAG" debug "MBS build id: $MBSID" @@ -453,6 +497,10 @@ if [[ -z "$builds_in_m" ]]; then fi mmd_url="$(mk_url_mmd "$m_nvr" "$ARCH")" +if ! url_exists "$mmd_url"; then + echo "$m_nvr has probably not been built for $ARCH" + exit $RET_NO_MODULE_ARCH +fi mmd_file="$(basename "$mmd_url")" mmd_dir="$(mktemp --directory)" download_artifact "$mmd_url" "$mmd_dir" diff --git a/viewer/generate-result-json b/viewer/generate-result-json index 957972c..238e003 100755 --- a/viewer/generate-result-json +++ b/viewer/generate-result-json @@ -31,6 +31,10 @@ for log in mtps_log_dir.iterdir(): test_name = "download build" test_object = None + if test_object == "mtps-get-module": + test_name = "module info" + test_object = None + results[test_name].append( { "result": RESULTS_MAPPING[result],