Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@

# TODO: Replace this by a RHEL 10.2 image when its RPM repositories are released.
# rhel-10.2
rhel-10.1
rhel-10.2
131 changes: 131 additions & 0 deletions test/scenarios-bootc/el10/releases/el102@rpm-standard1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/bin/bash

# Sourced from scenario.sh and uses functions defined there.

# The RPM-based image used to create the VM for this test does not
# include MicroShift or greenboot, so tell the framework not to wait
# for greenboot to finish when creating the VM.
export SKIP_GREENBOOT=true

# NOTE: Unlike most suites, these tests rely on being run IN ORDER to
# ensure the host is in a good state at the start of each test. We
# could have separated them and run them as separate scenarios, but
# did not want to spend the resources on a new VM.
export TEST_RANDOMIZATION=none

# On RHEL 10, rhocp and fast-datapath repos are not available via
# subscription-manager. Create repo files pointing to the RHEL 9 CDN
# using entitlement certificates as a workaround.
configure_cdn_repo() {
local -r repo_id=$1
local -r repo_name=$2
local -r baseurl=$3

local -r cert=$(run_command_on_vm host1 "ls /etc/pki/entitlement/[0-9]*.pem | grep -v '\-key.pem' | head -n1")
local -r key=$(run_command_on_vm host1 "ls /etc/pki/entitlement/[0-9]*-key.pem | head -n1")
local -r tmp_file=$(mktemp)

tee "${tmp_file}" >/dev/null <<EOF
[${repo_id}]
name=${repo_name}
baseurl=${baseurl}
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify=1
sslcacert=/etc/rhsm/ca/redhat-uep.pem
sslclientcert=${cert}
sslclientkey=${key}
EOF
copy_file_to_vm host1 "${tmp_file}" "${tmp_file}"
run_command_on_vm host1 "sudo cp ${tmp_file} /etc/yum.repos.d/${repo_id}.repo"
rm -f "${tmp_file}"
}

configure_rhocp_repo() {
local -r rhocp=$1
local -r major=$2
local -r minor=$3
local -r arch=${4:-$(uname -m)}

# The repository may be empty if the beta mirror is not up yet
if [[ -z "${rhocp}" ]] ; then
return
fi

if [[ "${rhocp}" =~ ^[0-9]{1,2}$ ]]; then
configure_cdn_repo \
"rhocp-${major}.${rhocp}" \
"Red Hat OpenShift ${major}.${rhocp} for RHEL 9" \
"https://cdn.redhat.com/content/dist/layered/rhel9/${arch}/rhocp/${major}.${rhocp}/os"
elif [[ "${rhocp}" =~ ^http ]]; then
local -r ocp_repo_name="rhocp-${major}.${minor}-for-rhel-9-mirrorbeta-rpms"
local -r tmp_file=$(mktemp)

tee "${tmp_file}" >/dev/null <<EOF
[${ocp_repo_name}]
name=Beta rhocp RPMs for RHEL 9
baseurl=${rhocp}
enabled=1
gpgcheck=0
skip_if_unavailable=0
EOF
copy_file_to_vm host1 "${tmp_file}" "${tmp_file}"
run_command_on_vm host1 "sudo cp ${tmp_file} /etc/yum.repos.d/${ocp_repo_name}.repo"
rm -f "${tmp_file}"
fi
}

scenario_create_vms() {
exit_if_brew_rpms_not_found

prepare_kickstart host1 kickstart-liveimg.ks.template ""
launch_vm rhel102-installer

# Open the firewall ports. Other scenarios get this behavior by
# embedding settings in the blueprint, but there is no blueprint
# for this scenario. We need do this step before running the RF
# suite so that suite can assume it can reach all of the same
# ports as for any other test.
configure_vm_firewall host1

# Register the host with subscription manager so we can install
# dependencies.
subscription_manager_register host1
}

scenario_remove_vms() {
exit_if_brew_rpms_not_found

remove_vm host1
}

scenario_run_tests() {
exit_if_brew_rpms_not_found

local -r reponame=$(basename "${BREW_REPO}")
local -r repo_url="${WEB_SERVER_URL}/rpm-repos/${reponame}"
local -r arch=$(uname -m)

# Enable the rhocp and dependency repositories.
#
# Note that rhocp or beta dependencies repository may not yet exist
# for the current version. Then, just use whatever we can get for
# the previous minor version.
configure_rhocp_repo "${RHOCP_MINOR_Y}" "${MAJOR_VERSION}" "${MINOR_VERSION}"
configure_rhocp_repo "${RHOCP_MINOR_Y_BETA}" "${MAJOR_VERSION}" "${MINOR_VERSION}"
run_command_on_vm host1 "sudo subscription-manager release --set 10.2"
configure_cdn_repo \
"fast-datapath" \
"Red Hat Fast Datapath for RHEL 9" \
"https://cdn.redhat.com/content/dist/layered/rhel9/${arch}/fast-datapath/os"

run_tests host1 \
--exitonfailure \
--variable "SOURCE_REPO_URL:${repo_url}" \
--variable "TARGET_VERSION:${BREW_LREL_RELEASE_VERSION}" \
--variable "EXPECTED_OS_VERSION:10.2" \
suites/rpm/install.robot \
suites/standard1/ \
suites/rpm/remove.robot
}
130 changes: 130 additions & 0 deletions test/scenarios-bootc/el10/releases/el102@rpm-standard2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/bin/bash

# Sourced from scenario.sh and uses functions defined there.

# The RPM-based image used to create the VM for this test does not
# include MicroShift or greenboot, so tell the framework not to wait
# for greenboot to finish when creating the VM.
export SKIP_GREENBOOT=true

# NOTE: Unlike most suites, these tests rely on being run IN ORDER to
# ensure the host is in a good state at the start of each test. We
# could have separated them and run them as separate scenarios, but
# did not want to spend the resources on a new VM.
export TEST_RANDOMIZATION=none

# On RHEL 10, rhocp and fast-datapath repos are not available via
# subscription-manager. Create repo files pointing to the RHEL 9 CDN
# using entitlement certificates as a workaround.
configure_cdn_repo() {
local -r repo_id=$1
local -r repo_name=$2
local -r baseurl=$3

local -r cert=$(run_command_on_vm host1 "ls /etc/pki/entitlement/[0-9]*.pem | grep -v '\-key.pem' | head -n1")
local -r key=$(run_command_on_vm host1 "ls /etc/pki/entitlement/[0-9]*-key.pem | head -n1")
local -r tmp_file=$(mktemp)

tee "${tmp_file}" >/dev/null <<EOF
[${repo_id}]
name=${repo_name}
baseurl=${baseurl}
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify=1
sslcacert=/etc/rhsm/ca/redhat-uep.pem
sslclientcert=${cert}
sslclientkey=${key}
EOF
copy_file_to_vm host1 "${tmp_file}" "${tmp_file}"
run_command_on_vm host1 "sudo cp ${tmp_file} /etc/yum.repos.d/${repo_id}.repo"
rm -f "${tmp_file}"
}

configure_rhocp_repo() {
local -r rhocp=$1
local -r major=$2
local -r minor=$3
local -r arch=${4:-$(uname -m)}

# The repository may be empty if the beta mirror is not up yet
if [[ -z "${rhocp}" ]] ; then
return
fi

if [[ "${rhocp}" =~ ^[0-9]{1,2}$ ]]; then
configure_cdn_repo \
"rhocp-${major}.${rhocp}" \
"Red Hat OpenShift ${major}.${rhocp} for RHEL 9" \
"https://cdn.redhat.com/content/dist/layered/rhel9/${arch}/rhocp/${major}.${rhocp}/os"
elif [[ "${rhocp}" =~ ^http ]]; then
local -r ocp_repo_name="rhocp-${major}.${minor}-for-rhel-9-mirrorbeta-rpms"
local -r tmp_file=$(mktemp)

tee "${tmp_file}" >/dev/null <<EOF
[${ocp_repo_name}]
name=Beta rhocp RPMs for RHEL 9
baseurl=${rhocp}
enabled=1
gpgcheck=0
skip_if_unavailable=0
EOF
copy_file_to_vm host1 "${tmp_file}" "${tmp_file}"
run_command_on_vm host1 "sudo cp ${tmp_file} /etc/yum.repos.d/${ocp_repo_name}.repo"
rm -f "${tmp_file}"
fi
}

scenario_create_vms() {
exit_if_brew_rpms_not_found

prepare_kickstart host1 kickstart-liveimg.ks.template ""
launch_vm rhel102-installer

# Open the firewall ports. Other scenarios get this behavior by
# embedding settings in the blueprint, but there is no blueprint
# for this scenario. We need do this step before running the RF
# suite so that suite can assume it can reach all of the same
# ports as for any other test.
configure_vm_firewall host1

# Register the host with subscription manager so we can install
# dependencies.
subscription_manager_register host1
}

scenario_remove_vms() {
exit_if_brew_rpms_not_found

remove_vm host1
}

scenario_run_tests() {
exit_if_brew_rpms_not_found

local -r reponame=$(basename "${BREW_REPO}")
local -r repo_url="${WEB_SERVER_URL}/rpm-repos/${reponame}"
local -r arch=$(uname -m)

# Enable the rhocp and dependency repositories.
#
# Note that rhocp or beta dependencies repository may not yet exist
# for the current version. Then, just use whatever we can get for
# the previous minor version.
configure_rhocp_repo "${RHOCP_MINOR_Y}" "${MAJOR_VERSION}" "${MINOR_VERSION}"
configure_rhocp_repo "${RHOCP_MINOR_Y_BETA}" "${MAJOR_VERSION}" "${MINOR_VERSION}"
run_command_on_vm host1 "sudo subscription-manager release --set 10.2"
configure_cdn_repo \
"fast-datapath" \
"Red Hat Fast Datapath for RHEL 9" \
"https://cdn.redhat.com/content/dist/layered/rhel9/${arch}/fast-datapath/os"

run_tests host1 \
--exitonfailure \
--variable "SOURCE_REPO_URL:${repo_url}" \
--variable "TARGET_VERSION:${BREW_LREL_RELEASE_VERSION}" \
suites/rpm/install.robot \
suites/standard2/ \
suites/rpm/remove.robot
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}