Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get list of installer image packages when probing boot.iso #1229

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read this correctly then the list of packages will get printed to stdout. If this is correct I think it would spam the test results a lot wouldn't it? Isn't it enough to just store the list?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the tests pass, you do not need to worry about extra lines in the output, if there is a failure it might be handy to see the package versions right in the test output. I actually like it this way :-)

Copy link
Contributor Author

@rvykydal rvykydal Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case it is handy to have this in the main log output without need of making sure we really pass / gather all the required logs (for example in GH actions). Also it is maybe more discoverable this way. Actually this information is very important when dealing with integration tests failures so let's make it as easily accessible as possible.


# 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