tests/ci: split nightly testing based on RHEL major version

Using just the major version from the $VERSION_ID and defining new CI
variable $RHEL_MAJOR.
This commit is contained in:
Jakub Rusz 2021-10-06 16:06:00 +02:00 committed by Ondřej Budai
parent ea97adfdf8
commit 14b7e92eaa
5 changed files with 42 additions and 33 deletions

View file

@ -84,14 +84,15 @@ Prepare-rhel-internal:
stage: prepare-rhel-internal
extends: .terraform
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule" && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/prepare-rhel-internal.sh
artifacts:
paths:
- rhel-8.json
- rhel8internal.repo
- rhel-8-beta.json
- rhel-${RHEL_MAJOR}.json
- rhel${RHEL_MAJOR}internal.repo
- rhel-${RHEL_MAJOR}-beta.json
- COMPOSE_ID
parallel:
matrix:
@ -99,6 +100,7 @@ Prepare-rhel-internal:
# NOTE: 1 runner prepares for all arches b/c subsequent jobs download
# artifacts from all previous jobs and the last one wins
- aws/rhel-8.6-nightly-x86_64
- aws/rhel-9.0-nightly-x86_64
INTERNAL_NETWORK: ["true"]
Base:
@ -106,7 +108,8 @@ Base:
extends: .terraform
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/base_tests.sh
@ -139,7 +142,8 @@ Regression:
extends: .terraform
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/regression.sh
@ -170,7 +174,8 @@ OSTree:
extends: .terraform/openstack
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/ostree.sh
@ -239,7 +244,8 @@ Integration:
extends: .terraform
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/${SCRIPT}
@ -281,7 +287,8 @@ API:
extends: .terraform
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/api.sh ${TARGET}
@ -312,7 +319,8 @@ libvirt:
extends: .terraform/openstack
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9.0-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8.6-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/libvirt.sh
@ -364,7 +372,8 @@ Installer:
extends: .terraform/openstack
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-[8-9]\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-9\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "9"'
- if: '$CI_PIPELINE_SOURCE == "schedule" && $RUNNER =~ /[\S]+rhel-8\.[0-9]-[^ga][\S]+/ && $NIGHTLY == "true" && $RHEL_MAJOR == "8"'
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/installers.sh

View file

@ -107,9 +107,9 @@ if [[ "$PROJECT" != "osbuild-composer" ]]; then
fi
fi
if [ -f "rhel8internal.repo" ]; then
if [ -f "rhel${VERSION_ID%.*}internal.repo" ]; then
greenprint "Preparing repos for internal build testing"
sudo mv rhel8internal.repo /etc/yum.repos.d/
sudo mv rhel"${VERSION_ID%.*}"internal.repo /etc/yum.repos.d/
# Use osbuild from schutzfile if desired for testing custom osbuild-composer packages
# specified by $REPO_URL in ENV and used in prepare-rhel-internal.sh
if [ "${SCHUTZ_OSBUILD:=false}" == true ]; then

View file

@ -17,11 +17,11 @@ fi
# Create a repository file for installing the osbuild-composer RPMs
greenprint "📜 Generating dnf repository file"
rm -f rhel8internal.repo
rm -f rhel"${VERSION_ID%.*}"internal.repo
for ARCH in $ALL_ARCHES; do
tee -a rhel8internal.repo << EOF
tee -a rhel"${VERSION_ID%.*}"internal.repo << EOF
[rhel8-internal-baseos-$ARCH]
[rhel${VERSION_ID}-internal-baseos-${ARCH}]
name=RHEL Internal BaseOS
baseurl=${COMPOSE_URL}/compose/BaseOS/${ARCH}/os/
enabled=1
@ -29,7 +29,7 @@ gpgcheck=0
# Default dnf repo priority is 99. Lower number means higher priority.
priority=1
[rhel8-internal-appstream-$ARCH]
[rhel${VERSION_ID}-internal-appstream-${ARCH}]
name=RHEL Internal AppStream
baseurl=${COMPOSE_URL}/compose/AppStream/${ARCH}/os/
enabled=1
@ -42,12 +42,12 @@ done
# Create an osbuild-composer JSON file for content consumption
greenprint "📜 Generate osbuild-composer JSON source file"
tee rhel-8.json << EOF
tee rhel-"${VERSION_ID%.*}".json << EOF
{
EOF
for ARCH in $ALL_ARCHES; do
tee -a rhel-8.json << EOF
tee -a rhel-"${VERSION_ID%.*}".json << EOF
"${ARCH}": [
{
"name": "baseos-${ARCH}",
@ -63,7 +63,7 @@ EOF
# only x86_64 has an RT repository
if [ "$ARCH" == "x86_64" ]; then
tee -a rhel-8.json << EOF
tee -a rhel-"${VERSION_ID%.*}".json << EOF
,{
"name": "rt-${ARCH}",
"baseurl": "${COMPOSE_URL}/compose/RT/${ARCH}/os",
@ -72,23 +72,23 @@ EOF
EOF
fi
tee -a rhel-8.json << EOF
tee -a rhel-"${VERSION_ID%.*}".json << EOF
]
EOF
# append comma for all arches except the last one
if [ "$ARCH" != "x86_64" ]; then
tee -a rhel-8.json << EOF
tee -a rhel-"${VERSION_ID%.*}".json << EOF
,
EOF
fi
done
tee -a rhel-8.json << EOF
tee -a rhel-"${VERSION_ID%.*}".json << EOF
}
EOF
cp rhel-8.json rhel-8-beta.json
cp rhel-"${VERSION_ID%.*}".json rhel-"${VERSION_ID%.*}"-beta.json
JOB_NAME="${JOB_NAME:-${CI_JOB_ID}}"
# Do not create tests repo if it's provided from ENV
@ -114,7 +114,7 @@ if [ -z "${REPO_URL+x}" ]; then
# version matches osbuild-composer from the internal tree
greenprint "Downloading osbuild-composer-tests RPMs from Brew"
for ARCH in $ALL_ARCHES; do
TESTS_RPM_URL=$(rpm -qp ./osbuild-composer-worker-*.rpm --qf "http://download.devel.redhat.com/brewroot/vol/rhel-8/packages/osbuild-composer/%{version}/%{release}/$ARCH/osbuild-composer-tests-%{version}-%{release}.$ARCH.rpm")
TESTS_RPM_URL=$(rpm -qp ./osbuild-composer-worker-*.rpm --qf "http://download.devel.redhat.com/brewroot/vol/rhel-${VERSION_ID%.*}/packages/osbuild-composer/%{version}/%{release}/$ARCH/osbuild-composer-tests-%{version}-%{release}.$ARCH.rpm")
wget --directory-prefix "$REPO_DIR_LATEST" "$TESTS_RPM_URL"
done
@ -145,7 +145,7 @@ fi
# amend repository file.
greenprint "📜 Amend dnf repository file"
tee -a rhel8internal.repo << EOF
tee -a rhel"${VERSION_ID%.*}"internal.repo << EOF
[osbuild-composer-tests-multi-arch]
name=Tests ${JOB_NAME}

View file

@ -8,16 +8,16 @@ if [[ $ID != rhel ]]; then
fi
if [[ $ID == rhel && ${VERSION_ID%.*} == 8 ]]; then
COMPOSE_ID=$(curl -L http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/latest-finished-RHEL-8.6/COMPOSE_ID)
COMPOSE_ID=$(curl -L http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/latest-finished-RHEL-"${VERSION_ID}"/COMPOSE_ID)
# default to a nightly tree but respect values passed from ENV so we can test rel-eng composes as well
COMPOSE_URL="${COMPOSE_URL:-http://download.devel.redhat.com/rhel-8/nightly/RHEL-8/$COMPOSE_ID}"
elif [[ $ID == rhel && ${VERSION_ID%.*} == 9 ]]; then
COMPOSE_ID=$(curl -L http://download.devel.redhat.com/rhel-9/nightly/RHEL-9-Beta/latest-RHEL-9.0/COMPOSE_ID)
COMPOSE_ID=$(curl -L http://download.devel.redhat.com/rhel-9/nightly/RHEL-9/latest-RHEL-"${VERSION_ID}"/COMPOSE_ID)
# default to a nightly tree but respect values passed from ENV so we can test rel-eng composes as well
COMPOSE_URL="${COMPOSE_URL:-http://download.devel.redhat.com/rhel-9/nightly/RHEL-9-Beta/$COMPOSE_ID}"
COMPOSE_URL="${COMPOSE_URL:-http://download.devel.redhat.com/rhel-9/nightly/RHEL-9/$COMPOSE_ID}"
fi
# in case COMPOSE_URL was defined from the outside refresh COMPOSE_ID file,

View file

@ -90,12 +90,12 @@ esac
# overrides for RHEL nightly builds testing
VERSION_SUFFIX=$(echo "${VERSION_ID}" | tr -d ".")
if [ -f "rhel-8.json" ]; then
sudo cp rhel-8.json "$REPODIR/rhel-${VERSION_SUFFIX}.json"
if [ -f "rhel-${VERSION_ID%.*}.json" ]; then
sudo cp rhel-"${VERSION_ID%.*}".json "$REPODIR/rhel-${VERSION_SUFFIX}.json"
fi
if [ -f "rhel-8-beta.json" ]; then
sudo cp rhel-8-beta.json "$REPODIR/rhel-${VERSION_SUFFIX}-beta.json"
if [ -f "rhel-${VERSION_ID%.*}-beta.json" ]; then
sudo cp rhel-"${VERSION_ID%.*}"-beta.json "$REPODIR/rhel-${VERSION_SUFFIX}-beta.json"
fi
# Generate all X.509 certificates for the tests