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

kola/rpm-ostree/replace-rt-kernel: do not hardcode kernel versions #1309

Merged
merged 1 commit into from
Jun 14, 2023
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
4 changes: 3 additions & 1 deletion kola-denylist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
- ppc64le

- pattern: ext.config.rpm-ostree.replace-rt-kernel
tracker: https://github.com/openshift/os/issues/1099
tracker: https://github.com/openshift/os/issues/1315
osversion:
- c9s

- pattern: iso-live-login.uefi-secure
tracker: https://github.com/openshift/os/issues/1237
Expand Down
64 changes: 25 additions & 39 deletions tests/kola/rpm-ostree/replace-rt-kernel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
## kola:
## tags: "needs-internet"
## timeoutMin: 30
## # We've seen some OOM when 1024M is used in similar tests:
## # https://github.com/coreos/fedora-coreos-tracker/issues/1506
## minMemory: 2048
## description: Verify replacing the current kernel with an
## older centos kernel and replacing with kernel-rt.

Expand All @@ -15,68 +18,51 @@ runv () {
}

basearch=$(arch)
rhelver=$(. /usr/lib/os-release && echo "${RHEL_VERSION}")
major=$(echo "${rhelver}" | cut -f 1 -d .)
major=$(. /usr/lib/os-release && echo "${CPE_NAME}" | grep -Eo '[0-9]{1,2}')
baseurl=
case "${major}" in
8)
# TODO: why the heck does centos only support insecure http?!?
baseurl=http://mirror.centos.org/centos/8-stream/
# TODO avoid hardcoding versions
target_kver=4.18.0-383.el8
target_kver_rt=4.18.0-394.rt7.179.el8
;;
9)
# TODO: why the heck does centos only support insecure http?!?
baseurl=http://mirror.stream.centos.org/9-stream/
# TODO avoid hardcoding versions
target_kver=5.14.0-196.el9
target_kver_rt=5.14.0-201.rt14.202.el9
baseurl=https://mirror.stream.centos.org/9-stream/
repo_url=https://github.com/raw/openshift/os/master/c9s.repo
;;
*) fatal "Unhandled RHEL_VERSION=${rhelver}"
*) fatal "Unhandled major RHEL/SCOS VERSION=${major}"
;;
esac

# setup repos
runv rm -rf /etc/yum.repos.d/*
runv curl -sSLf "${repo_url}" -o /etc/yum.repos.d/cs.repo
runv curl -sSLf https://centos.org/keys/RPM-GPG-KEY-CentOS-Official -o /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official
runv sed -i 's|^gpgkey.*|gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official|' /etc/yum.repos.d/cs.repo
Copy link
Member

@LorbusChris LorbusChris Jun 13, 2023

Choose a reason for hiding this comment

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

This sed invocation also replaces other unrelated keys.

Analog to https://github.com/openshift/os/blob/master/extensions/Dockerfile#L13-L17:

Suggested change
runv sed -i 's|^gpgkey.*|gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official|' /etc/yum.repos.d/cs.repo
runv sed -i 's|/usr/share/distribution-gpg-keys/centos|/etc/pki/rpm-gpg|' /etc/yum.repos.d/cs.repo

Edit: Edited for clarity.

Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused here. This is running inside the RHCOS machine (throw away test machine). What change are you suggesting and why is it important?

Copy link
Member

Choose a reason for hiding this comment

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

To me it looks like rpm-ostree may be failing when trying to verify the repos in c9s.repo. The keys for all of them have to be available. Blanket replacing all of them with one key won't work.

Copy link
Member

Choose a reason for hiding this comment

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

hmm. but this test as written passes on RHCOS (@jmarrero, correct me if I am wrong).

According to @jmarrero it fails on SCOS though and we aren't sure why yet.

Copy link
Member

Choose a reason for hiding this comment

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

And we do have repo_gpgcheck=0 on the repos in c9s.repo. I might've pulled a false alarm here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct this passes on RHCOS both on CI & locally

Copy link
Member

Choose a reason for hiding this comment

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

The problem here is that those reference distribution-gpg-keys which we don't ship in the OS by default. I think @LorbusChris 's suggestion makes sense...

But I don't understand actually why we're removing the repo files by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is because this is a test for RHCOS only at the moment, I am just making sure there nothing on yum.repos.d before downloading the centos repo. When I get to the SCOS test, the plan is to just use the provided repos/keys and just turn on the rt repo if it's disabled.

Copy link
Member

Choose a reason for hiding this comment

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

see also #1316


case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
echo "Testing overriding with previous CentOS Stream kernel"
kver=$(uname -r)
if test "${kver}" = "${target_kver}"; then
fatal "Already in ${target_kver}"
fi
tmpdir=$(mktemp -d -p /var/tmp)
pushd "${tmpdir}"
runv curl -sSLf --remote-name-all "${baseurl}/BaseOS/${basearch}/os/Packages/kernel"{,-core,-modules,-modules-extra}"-${target_kver}.${basearch}.rpm"
runv rpm-ostree override replace ./*.rpm
popd
rm "${tmpdir}" -rf
echo "Testing overriding with CentOS Stream kernel"
runv rpm-ostree override replace --experimental --from repo=baseos kernel{,-core,-modules,-modules-extra,-modules-core}
runv /tmp/autopkgtest-reboot 1
;;
1)
case $(uname -r) in
"${target_kver}.${basearch}")
case $(rpm -qi kernel-core | grep Vendor) in
*"CentOS")
echo "ok kernel override"
;;
*)
runv uname -r
runv rpm -q kernel
fatal "Failed to apply kernel override to ${target_kver}"
runv rpm -qi kernel-core
fatal "Failed to apply kernel override"
;;
esac

echo "Testing overriding with CentOS Stream RT kernel"
case $basearch in
x86_64)
tmpdir=$(mktemp -d -p /var/tmp)
pushd "${tmpdir}"
runv rpm-ostree override reset -a
runv curl -sSLf --remote-name-all "${baseurl}/NFV/${basearch}/os/Packages/kernel-rt"{-core,-modules,-modules-extra,-kvm}"-${target_kver_rt}.${basearch}.rpm"
kernel_pkgs=("kernel-rt-core" "kernel-rt-modules" "kernel-rt-modules-extra" "kernel-rt-modules-core")
args=()
for x in ./*.rpm; do
args+=(--install ./"${x}")
for x in ${kernel_pkgs}; do
args+=(--install "${x}")
done
runv rpm-ostree override remove kernel{,-core,-modules,-modules-extra} "${args[@]}"
rm "${tmpdir}" -rf
runv rpm-ostree override remove kernel{,-core,-modules,-modules-extra,-modules-core} "${args[@]}"
runv /tmp/autopkgtest-reboot 2
;;
*) echo "note: no kernel-rt for $basearch"; exit 0
Expand All @@ -85,11 +71,11 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
;;
2)
case $(uname -r) in
"${target_kver_rt}.${basearch}") echo "ok kernel-rt" ;;
*".${basearch}+rt") echo "ok kernel-rt" ;;
*)
uname -r
rpm -q kernel-rt
fatal "Failed to apply kernel override to ${target_kver_rt}"
fatal "Failed to apply rt kernel override"
;;
esac
;;
Expand Down