tests: enable regression tests on RHEL-9

This commit adds the possibility to use both weldr-client and original
composer-cli in the tests.
This commit is contained in:
Jakub Rusz 2021-09-07 14:09:23 +02:00 committed by Achilleas Koutsou
parent e136434bdf
commit e8d0d8b9de
4 changed files with 73 additions and 33 deletions

View file

@ -153,6 +153,8 @@ Regression:
- aws/rhel-8-aarch64
- aws/rhel-8.5-x86_64
- aws/rhel-8.5-aarch64
- aws/rhel-9.0-beta-nightly-x86_64
- aws/rhel-9.0-beta-nightly-aarch64
INTERNAL_NETWORK: ["true"]
artifacts:
paths:

View file

@ -84,8 +84,23 @@ case "${ID}" in
fi
;;
"9" )
echo "Running on RHEL 9 is not yet supported"
exit 0
echo "Running on RHEL ${VERSION_ID}"
# in 9.0 the override file contains minor version number as well
VERSION_SUFFIX=$(echo "${VERSION_ID}" | tr -d ".")
if grep beta /etc/os-release;
then
DISTRO_NAME="rhel-90-beta"
REPOSITORY_OVERRIDE="/etc/osbuild-composer/repositories/rhel-${VERSION_SUFFIX}-beta.json"
else
DISTRO_NAME="rhel-90"
REPOSITORY_OVERRIDE="/etc/osbuild-composer/repositories/rhel-${VERSION_SUFFIX}.json"
fi
REPO1_NAME="baseos"
REPO2_NAME="appstream"
if [ -n "${NIGHTLY:-}" ]; then
REPO1_NAME="baseos-${ARCH}"
REPO2_NAME="appstream-${ARCH}"
fi
;;
*)
echo "Unknown RHEL: ${VERSION_ID}"
@ -295,13 +310,21 @@ then
sudo journalctl -xe --unit osbuild-worker
exit 1
fi
COMPOSE_ID=$(jq -r '.build_id' "${COMPOSE_START}")
if rpm -q --quiet weldr-client; then
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
else
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
fi
# Wait for the compose to finish.
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
while true; do
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "${COMPOSE_INFO}" > /dev/null
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
if rpm -q --quiet weldr-client; then
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
else
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
fi
# Is the compose finished?
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
@ -320,4 +343,4 @@ sudo journalctl -xe --unit osbuild-worker
if [[ $COMPOSE_STATUS != FINISHED ]]; then
echo "Something went wrong with the compose. 😢"
exit 1
fi
fi

View file

@ -5,21 +5,21 @@
# osbuild-composer doesn't fail to depsolve this blueprint.
#
# The script currently works only for RHEL and CentOS which provide
# "redhat-lsb-core" package and exclude "nss" package in the image type
# definition. The testing contains the "redhat-lsb-core" package which can only
# "nss-devel" package and exclude "nss" package in the image type
# definition. The testing contains the "nss-devel" package which can only
# be installed if the "nss" package isn't excluded
#
# Bug report: https://github.com/osbuild/osbuild-composer/issues/921
# NOTE: ONLY WORKS IN RHEL 8.5
# NOTE: ONLY WORKS IN RHEL 8.5 and RHEL 9.0
# Get OS data.
source /etc/os-release
# Provision the software under test.
/usr/libexec/osbuild-composer-test/provision.sh
if [[ "${ID}-${VERSION_ID}" != "rhel-8.5" ]]; then
echo "$0 is only enabled for rhel-8.5; skipping..."
if [[ "${ID}-${VERSION_ID}" != "rhel-8.5" && "${ID}-${VERSION_ID}" != "rhel-9.0" ]]; then
echo "$0 is only enabled for rhel-8.5 and rhel-9.0; skipping..."
exit 0
fi
@ -32,27 +32,34 @@ COMPOSE_INFO=/tmp/compose-info.json
# Write a basic blueprint for our image.
tee "$BLUEPRINT_FILE" > /dev/null << EOF
name = "redhat-lsb-core"
description = "A base system with redhat-lsb-core"
name = "nss-devel"
description = "A base system with nss-devel"
version = "0.0.1"
# The nss package is excluded in the RHEL 8.5 image type and is required by the
# redhat-lsb-core package. This test verifies the excluded dependency doesn't
# restrict the installation of the dependant.
# The nss package is excluded in the RHEL 8.5 and RHEL 9.0 qcow image type
# and is required by the nss-devel package. This test verifies the excluded
# dependency doesn't restrict the installation of the dependant.
[[packages]]
name = "redhat-lsb-core"
name = "nss-devel"
EOF
sudo composer-cli blueprints push "$BLUEPRINT_FILE"
sudo composer-cli blueprints depsolve redhat-lsb-core
sudo composer-cli --json compose start redhat-lsb-core qcow2 | tee "${COMPOSE_START}"
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
sudo composer-cli blueprints depsolve nss-devel
sudo composer-cli --json compose start nss-devel qcow2 | tee "${COMPOSE_START}"
if rpm -q --quiet weldr-client; then
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
else
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
fi
# Wait for the compose to finish.
echo "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
while true; do
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
if rpm -q --quiet weldr-client; then
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
else
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
fi
# Is the compose finished?
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then

View file

@ -5,10 +5,10 @@
# doesn't fail to depsolve this blueprint.
#
# The script currently works only for RHEL and CentOS which provide
# "redhat-lsb-core" package and exclude "nss" package in the image type
# "nss-devel" package and exclude "nss" package in the image type
# definition. The testing blueprint contains explicit "nss" requirement
# to remove it from the list of excluded packages and thus enable the
# installation of "redhat-lsb-core".
# installation of "nss-devel".
#
# Bug report: https://github.com/osbuild/osbuild-composer/issues/921
@ -27,30 +27,38 @@ fi
# Write a basic blueprint for our image.
tee "$BLUEPRINT_FILE" > /dev/null << EOF
name = "redhat-lsb-core"
description = "A base system with redhat-lsb-core"
name = "nss-devel"
description = "A base system with nss-devel"
version = "0.0.1"
[[packages]]
name = "redhat-lsb-core"
name = "nss-devel"
[[packages]]
# The nss package is excluded in the RHEL8.4 image type, but it is required by the
# redhat-lsb-core package. This test verifies it can be added again when explicitly
# mentioned in the blueprint.
# The nss package is excluded in the RHEL8.4, RHEL8.5 and RHEL9.0 qcow image type
# but it is required by the nss-devel package.This test verifies it can be added
# again when explicitly mentioned in the blueprint.
name = "nss"
EOF
sudo composer-cli blueprints push "$BLUEPRINT_FILE"
sudo composer-cli blueprints depsolve redhat-lsb-core
sudo composer-cli --json compose start redhat-lsb-core qcow2 | tee "${COMPOSE_START}"
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
sudo composer-cli blueprints depsolve nss-devel
sudo composer-cli --json compose start nss-devel qcow2 | tee "${COMPOSE_START}"
if rpm -q --quiet weldr-client; then
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
else
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
fi
# Wait for the compose to finish.
echo "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
while true; do
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
if rpm -q --quiet weldr-client; then
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
else
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
fi
# Is the compose finished?
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then