tools: support rhel-9 in deploy.sh

There is not yet and official epel-9 repo so use an internal
implementation in the mean time as well as internal repositories during
the testing.
This commit is contained in:
Jakub Rusz 2021-08-24 12:15:24 +02:00 committed by jrusz
parent 8c26614049
commit 231499c5d4

View file

@ -2,13 +2,25 @@
set -euxo pipefail
source /etc/os-release
ARCH=$(uname -m)
# koji and ansible are not in RHEL repositories. Depending on them in the spec
# file breaks RHEL gating (see OSCI-1541). Therefore, we need to enable epel
# and install koji and ansible here.
if [[ $ID == rhel || $ID == centos ]]; then
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
if [[ $ID == rhel || $ID == centos ]] && [[ ${VERSION_ID%.*} == 8 ]] && ! rpm -q epel-release; then
curl -Ls --retry 5 --output /tmp/epel.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo rpm -Uvh /tmp/epel.rpm
sudo dnf install -y koji ansible
elif [[ $ID == rhel || $ID == centos ]] && [[ ${VERSION_ID%.*} == 9 ]]; then
# we have our own small epel for EL9, let's install it
# install Red Hat certificate, otherwise dnf copr fails
curl -LO --insecure https://hdn.corp.redhat.com/rhel8-csb/RPMS/noarch/redhat-internal-cert-install-0.1-23.el7.csb.noarch.rpm
sudo dnf install -y ./redhat-internal-cert-install-0.1-23.el7.csb.noarch.rpm dnf-plugins-core
sudo dnf copr enable -y copr.devel.redhat.com/osbuild-team/epel-el9 "rhel-9.dev-$ARCH"
# koji is not available yet apparently
sudo dnf install -y ansible
fi
sudo mkdir -p /etc/osbuild-composer
@ -53,8 +65,9 @@ sudo mkdir -p $REPODIR
sudo cp -a /usr/share/tests/osbuild-composer/repositories/{fedora,centos}-*.json "$REPODIR"
# Copy RHEL point relese repos
sudo cp /usr/share/tests/osbuild-composer/repositories/rhel-85.json "$REPODIR"
sudo cp /usr/share/tests/osbuild-composer/repositories/rhel-90.json "$REPODIR"
# RHEL nightly repos need to be overridden in rhel-8.json and rhel-8-beta.json
# RHEL nightly repos need to be overridden
case "${ID}-${VERSION_ID}" in
"rhel-8.5")
# Override old rhel-8.json and rhel-8-beta.json because RHEL 8.5 test needs nightly repos
@ -62,6 +75,12 @@ case "${ID}-${VERSION_ID}" in
# If multiple tests are run and call provision.sh the symlink will need to be overridden with -f
sudo ln -sf /etc/osbuild-composer/repositories/rhel-8.json "$REPODIR/rhel-8-beta.json"
;;
"rhel-9.0")
# Override old rhel-90.json and rhel-90-beta.json because RHEL 9.0 test needs nightly repos
sudo cp /usr/share/tests/osbuild-composer/repositories/rhel-90.json "$REPODIR/rhel-90.json"
# If multiple tests are run and call provision.sh the symlink will need to be overridden with -f
sudo ln -sf /etc/osbuild-composer/repositories/rhel-90.json "$REPODIR/rhel-90-beta.json"
;;
*) ;;
esac