Skip to content

Commit

Permalink
Get list of installer image packages when probing boot.iso
Browse files Browse the repository at this point in the history
  • Loading branch information
rvykydal committed Jun 25, 2024
1 parent d066a78 commit 31837f4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion containers/runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ If you want to keep virtual machine of a finished test alive for further investi

If you want to prevent killing virtual machine of a test on a failure detected in the log before the installation finishes (eg `Traceback` indicated in the log) it is possible to configure monitored messages in the [log monitor](/scripts/launcher/lib/log_monitor/log_handler.py) file.

You can run the tests in dry-run mode using `--dry-run` option. It can be used to see which tests would be actually run and the kickstarts with substitutions applied.
You can run the tests in dry-run mode using `--dry-run` option. It can be used to see which tests would be actually run and the kickstarts with substitutions applied. Or to get the list of packages composing the installer image.

We are tracking the test suite issues and flakes in the repository issues. There is a [script](/scripts/classify-failures) to detect such known issues from test logs.
36 changes: 21 additions & 15 deletions scripts/probe_boot_iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ fi

IMAGE="$1"

# Fast path if ./discinfo is present (for Fedora); if it exists, it looks like this:
# 1587584254.021611
# 32
# x86_64
DISCINFO_VER=$(isoinfo -R -x /.discinfo -i "$IMAGE" | sed -n '2 p')
if [ -n "$DISCINFO_VER" ]; then
# make sure it looks like a Fedora version name/number
if [ "$DISCINFO_VER" = "Rawhide" ] || [ $(echo $DISCINFO_VER | cut -d. -f1) -gt 30 ]; then
echo "NAME=Fedora"
echo "VERSION=$DISCINFO_VER"
exit 0
fi
fi

# Probe boot.iso → install.img → stage 2 and dig out useful information from it.
ISO_TMP=$(mktemp -d /tmp/kstest-iso.XXXXXXX)
trap "rm -rf '$ISO_TMP'" EXIT INT QUIT PIPE
Expand All @@ -72,23 +58,43 @@ fi
# Extract files from stage2
OS_RELEASE=/etc/os-release
ROOTFS=/LiveOS/rootfs.img
LORAX_PACKAGES=/root/lorax-packages.log

unsquashfs -no-xattrs -follow -no-progress -d "$ISO_TMP/stage2" "$ISO_TMP/install.img" $OS_RELEASE $ROOTFS
unsquashfs -no-xattrs -follow -no-progress -d "$ISO_TMP/stage2" "$ISO_TMP/install.img" $OS_RELEASE $ROOTFS $LORAX_PACKAGES
rm "$ISO_TMP/install.img"
chmod -R a+w $ISO_TMP

# Extract required information from stage2
if [ -e "$ISO_TMP/stage2$OS_RELEASE" ]; then
cp "$ISO_TMP/stage2$OS_RELEASE" "$ISO_TMP/os-release"
cp "$ISO_TMP/stage2$LORAX_PACKAGES" "$ISO_TMP/lorax-packages.log"
else
# On RHEL-8 and RHEL-9 the filesystem is packed in ext4 image (ENGCMP-766)
timeout -k 10s 30s virt-cat -a "$ISO_TMP/stage2$ROOTFS" $OS_RELEASE > "$ISO_TMP/os-release"
timeout -k 10s 30s virt-cat -a "$ISO_TMP/stage2$ROOTFS" $LORAX_PACKAGES > "$ISO_TMP/lorax-packages.log"
if [ $? -eq 124 ]; then
echo "Error: virt-cat timed out" >&2
exit 4
fi
fi

echo "PACKAGES=$(cat $ISO_TMP/lorax-packages.log | tr '\n' ' ')"

# Fast path to get version if ./discinfo is present (for Fedora); if it exists, it looks like this:
# 1587584254.021611
# 32
# x86_64
DISCINFO_VER=$(isoinfo -R -x /.discinfo -i "$IMAGE" | sed -n '2 p')
if [ -n "$DISCINFO_VER" ]; then
# make sure it looks like a Fedora version name/number
if [ "$DISCINFO_VER" = "Rawhide" ] || [ $(echo $DISCINFO_VER | cut -d. -f1) -gt 30 ]; then
echo "NAME=Fedora"
echo "VERSION=$DISCINFO_VER"
exit 0
fi
fi


# Return useful information to stdout
echo "NAME=$(. "$ISO_TMP/os-release"; echo "$ID")"
echo "VERSION=$(. "$ISO_TMP/os-release"; echo "$VERSION_ID")"
5 changes: 4 additions & 1 deletion scripts/run_kickstart_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ ISO_OS_NAME=$(echo "${output}" | grep 'NAME=')
ISO_OS_NAME="${ISO_OS_NAME##NAME=}"
ISO_OS_VERSION=$(echo "${output}" | grep 'VERSION=')
ISO_OS_VERSION="${ISO_OS_VERSION##VERSION=}"

ISO_PACKAGES=$(echo "${output}" | grep 'PACKAGES=')
ISO_PACKAGES="${ISO_PACKAGES##PACKAGES=}"
echo Saving list of installer image packages to /var/tmp/kstest-image-packages.log
echo $ISO_PACKAGES | tr ' ' '\n' | tee /var/tmp/kstest-image-packages.log

# Append sed args to substitute
sed_args=" -e s#@KSTEST_OS_NAME@#${ISO_OS_NAME}# -e s#@KSTEST_OS_VERSION@#${ISO_OS_VERSION}#"
Expand Down

0 comments on commit 31837f4

Please sign in to comment.