From dd209f70e39257d71f57c5040dc006e72ab745b1 Mon Sep 17 00:00:00 2001 From: akatch Date: Sat, 20 Nov 2021 12:29:01 -0600 Subject: [PATCH] Add wrapper script (#63) * Add wrapper script * Default build name uses ROCKY_VERSION * Wrapper script to print simple build report in Markdown format * Some openqa-cli example commands * Include BUILD_NAME in report header * Additional columns * Extra hyphen * Added @tcooper's suggestion --- EXAMPLES.md | 16 ++++++++++++++++ build-report.sh | 13 +++++++++++++ run-openqa-tests.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 EXAMPLES.md create mode 100755 build-report.sh create mode 100755 run-openqa-tests.sh diff --git a/EXAMPLES.md b/EXAMPLES.md new file mode 100644 index 00000000..7412eaa0 --- /dev/null +++ b/EXAMPLES.md @@ -0,0 +1,16 @@ +## Query all jobs from a named build + + openqa-cli api -X GET jobs build=$BUILDNAME + +## Failed jobs in a named build +The overview on the openQA home page counts incompletes as failures + + openqa-cli api -X GET jobs build=$BUILDNAME result=failed,incomplete + +## Print a simple report of all tests and their results from a named build + + openqa-cli api -X GET jobs build=$BUILDNAME | jq -r '.jobs[] | {name,result} | join(" ") | split("-") | last' | sort + +## Further Reading +[openqa-cli cheat sheet](https://openqa-bites.github.io/openqa/openqa-cli-cheat-sheet/) +[jq cheat sheet](https://lzone.de/cheat-sheet/jq) diff --git a/build-report.sh b/build-report.sh new file mode 100755 index 00000000..8edc978a --- /dev/null +++ b/build-report.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +BUILD_NAME=$1 + +printf '# Build%s\n' "$BUILD_NAME" +printf "| Test | Result | Failure Reason | Effort to Fix | Notes |\n" +printf "| ---- | ------ | -------------- | ------------ | ----- |\n" + +openqa-cli api -X GET jobs build="$BUILD_NAME" | \ + jq -r '.jobs[] | {name,result} | join(" | ") | split("-") | last' | \ + sort | \ + sed 's,^,| ,g;s,$, | | | |,g' diff --git a/run-openqa-tests.sh b/run-openqa-tests.sh new file mode 100755 index 00000000..109257b1 --- /dev/null +++ b/run-openqa-tests.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +ROCKY_FLAVOR=$1 +ROCKY_VERSION=8.5 +ROCKY_ARCH=x86_64 +ROCKY_PACKAGE_SET=minimal +BUILD_PREFIX="${ROCKY_VERSION}_${ROCKY_FLAVOR}" +BUILD_NAME="${BUILD_PREFIX}_$(date +%Y%m%d.%H%M%S).0" + +if [[ "$ROCKY_FLAVOR" == "dvd-iso" || "$ROCKY_FLAVOR" == "universal" ]]; then + ISO_TYPE=dvd1 +elif [[ "$ROCKY_FLAVOR" == "minimal-iso" ]]; then + ISO_TYPE=minimal +elif [[ "$ROCKY_FLAVOR" == "boot-iso" ]]; then + ISO_TYPE=boot +else + echo "Usage: $0 [universal|dvd-iso|minimal-iso|boot-iso]" + exit 1 +fi + +set -o xtrace +openqa-cli api \ + -X POST isos \ + ISO="Rocky-$ROCKY_VERSION-$ROCKY_ARCH-$ISO_TYPE.iso" \ + ARCH="$ROCKY_ARCH" \ + DISTRI=rocky \ + FLAVOR="$ROCKY_FLAVOR" \ + VERSION="$ROCKY_VERSION" \ + BUILD="$BUILD_NAME" \ + PACKAGE_SET="$ROCKY_PACKAGE_SET" \ + IDENTIFICATION=false