Skip to content

Commit

Permalink
fix: adds rhel 8.10 support to aws
Browse files Browse the repository at this point in the history
  • Loading branch information
faiq committed Oct 23, 2024
1 parent 3b2db9f commit 62cec79
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/aws-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ jobs:
buildConfig: "offline-fips"
- os: "redhat 8.8"
buildConfig: "offline-nvidia"
#RHEL 8.10
- os: "redhat 8.10"
buildConfig: "basic"
- os: "redhat 8.10"
buildConfig: "fips"
- os: "redhat 8.10"
buildConfig: "nvidia"
- os: "redhat 8.10"
buildConfig: "offline"
- os: "redhat 8.10"
buildConfig: "offline-fips"
- os: "redhat 8.10"
buildConfig: "offline-nvidia"
# SLES 15
- os: "sles 15"
buildConfig: "basic"
Expand Down
86 changes: 86 additions & 0 deletions bundles/redhat8.10/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
set -euo pipefail

# When yum operates on multiple packages, it does not, by default, return an error if a subset
# of packages is not found. This makes yum return an error.
echo skip_missing_names_on_install=False >> /etc/yum.conf

sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py
FOUND=false

RHSM_ORG_ID=${RHSM_ORG_ID:-""}
RHSM_ACTIVATION_KEY=${RHSM_ACTIVATION_KEY:-""}
RHSM_USER=${RHSM_USER:-""}
RHSM_PASS=${RHSM_PASS:-""}

if [[ -n "${RHSM_ORG_ID}" && -n "${RHSM_ACTIVATION_KEY}" ]]; then
subscription-manager register --org="${RHSM_ORG_ID}" --activationkey="${RHSM_ACTIVATION_KEY}" --force
FOUND=true
fi

if [[ -n "${RHSM_USER}" && -n "${RHSM_PASS}" && ${FOUND} == false ]]; then
subscription-manager register --username="${RHSM_USER}" --password="${RHSM_PASS}" --force
FOUND=true
fi

if [[ ${FOUND} == false ]]; then
echo "You must use subscription manager to fetch packages for redhat"
exit 1
fi

subscription::unregister() {
subscription-manager unregister
}

subscription::defer_unregister() {
trap subscription::unregister ABRT
trap subscription::unregister EXIT
trap subscription::unregister HUP
trap subscription::unregister INT
trap subscription::unregister TERM
trap subscription::unregister USR1
trap subscription::unregister USR2
}

subscription-manager release --set=8.10
subscription-manager refresh
subscription::defer_unregister

ENABLED_REPOS="codeready-builder-for-rhel-8-x86_64-rpms,rhel-8-for-x86_64-appstream-rpms,rhel-8-for-x86_64-baseos-rpms"
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
subscription-manager repos --enable rhel-8-for-x86_64-appstream-rpms
subscription-manager repos --enable rhel-8-for-x86_64-baseos-rpms
subscription-manager repos --disable=rhel-8-for-x86_64-baseos-eus-rpms --disable=rhel-8-for-x86_64-appstream-eus-rpms

KUBERNETES_REPOS=${KUBERNETES_REPOS:-""}
if [[ -n "${KUBERNETES_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},kubernetes"
fi

yum -y install gettext yum-utils createrepo dnf-utils modulemd-tools
yum clean all
TMP_DIR="$(mktemp -d repodata-XXXX)"
chmod 777 -R "${TMP_DIR}"
cp packages.txt "${TMP_DIR}"
pushd "${TMP_DIR}"
#shellcheck disable=SC2046,SC2062,SC2063,SC2035
repoquery --archlist=x86_64,noarch --resolve --requires --recursive $(< packages.txt) | grep -v *.i686 >> reqs.txt
sed -i 1d reqs.txt # we need to get rid of the first line
#shellcheck disable=SC2046
yumdownloader --archlist=x86_64,noarch \
--setopt=skip_missing_names_on_install=False -x \*i686 $(< reqs.txt) || true
#shellcheck disable=SC2046
yumdownloader --setopt=skip_missing_names_on_install=False -x \*i686 --archlist=x86_64,noarch \
--resolve --disablerepo=* --enablerepo="${ENABLED_REPOS}" \
$(< packages.txt) || true

rm packages.txt reqs.txt
createrepo -v .
repo2module . --module-name offline
createrepo_mod .
#shellcheck disable=SC1083,SC2035
tar -czf {{ .OutputDirectory }}/{{ .KubernetesVersion }}_redhat_8.10_x86_64{{ .FipsSuffix }}.tar.gz *
#shellcheck disable=SC1083
chmod 777 {{ .OutputDirectory }}/{{ .KubernetesVersion }}_redhat_8.10_x86_64{{ .FipsSuffix }}.tar.gz
popd
rm -rf "${TMP_DIR}"
41 changes: 41 additions & 0 deletions bundles/redhat8.10/packages.txt.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
audit
ca-certificates
conntrack-tools
chrony
ebtables
open-vm-tools
python2-pip
python3-pip
socat
yum-utils
yum-plugin-versionlock
NetworkManager
cloud-init
cloud-utils-growpart
container-selinux
{{ if .FetchKubernetesRPMs -}}
kubectl-{{ .KubernetesVersion }}-0
kubelet-{{ .KubernetesVersion }}-0
kubeadm-{{ .KubernetesVersion }}-0
cri-tools
{{- end }}
conntrack
ebtables
ethtool
iproute
iptables
iscsi-initiator-utils
socat
gcc
glibc-devel
make
libseccomp
iproute-tc
gssproxy
libverto-module-base
libverto
nfs-utils
{{ if .FetchKernelHeaders -}}
kernel-headers
kernel-devel
{{- end }}
5 changes: 5 additions & 0 deletions bundles/redhat8.10/repo-templates/kubernetes.repo.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[kubernetes]
name=Konvoy Kubernetes package repository
baseurl=https://packages.d2iq.com/konvoy/stable/linux/repos/el/kubernetes-v{{ .KubernetesVersion }}-{{ .RepoSuffix }}/x86_64
gpgcheck=1
gpgkey=https://packages.d2iq.com/konvoy/stable/linux/repos/d2iq-sign-authority-gpg-public-key
14 changes: 14 additions & 0 deletions images/ami/rhel-810.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
build_name: "rhel-8.10"
packer_builder_type: "amazon"
python_path: ""
packer:
ami_filter_name: "RHEL-8.10.0_HVM-*"
ami_filter_owners: "309956199498"
distribution: "RHEL"
distribution_version: "8.10"
source_ami: ""
ssh_username: "ec2-user"
root_device_name: "/dev/sda1"
volume_size: "15"

0 comments on commit 62cec79

Please sign in to comment.