@@ -23,41 +23,20 @@ source /etc/os-release
2323# XXX: For SCOS, only allow certain packages to come from ART; everything else
2424# should come from CentOS. We should eventually sever this.
2525if [ $ID = centos ]; then
26- # this says: "if the line starts with [.*], turn off printing. if the line starts with [our-repo], turn it on."
27- awk " /\[.*\]/{p=0} /\[rhel-10.2-server-ose-5.0\]/{p=1} p" /etc/yum.repos.d/* .repo > /etc/yum.repos.d/okd.repo.tmp
28- sed -i -e ' s,\[rhel-10.2-server-ose-5.0\],\[rhel-10.2-server-ose-5.0-okd\],' /etc/yum.repos.d/okd.repo.tmp
29- echo ' includepkgs=openshift-*,ose-aws-ecr-*,ose-azure-acr-*,ose-gcp-gcr-*,ose-crio-* ' >> /etc/yum.repos.d/okd.repo.tmp
30- mv /etc/yum.repos.d/okd.repo{.tmp,}
26+ OPENSHIFT_ART_REPO_NAME=${YUM_REPO_NAMES/* ,/ } # ART repo == the last repo in the list
27+ dnf config-manager --save \
28+ --setopt=" ${OPENSHIFT_ART_REPO_NAME} .includepkgs=openshift-*,ose-aws-ecr-*,ose-azure-acr-*,ose-gcp-gcr-*,ose-crio-*"
3129fi
3230
3331# XXX: patch cri-o spec to use tmpfiles
3432# https://github.com/CentOS/centos-bootc/issues/393
3533mkdir -p /var/opt
3634
37- # Disable repos that don't match the current OS version to avoid 401 errors
38- # when rpm-ostree tries to access all repos. This replicates the conditional-include
39- # logic that was previously in packages-openshift.yaml.
40- if [ " $ID " = " rhel" ]; then
41- if [ " $VERSION_ID " = " 9.8" ]; then
42- # Disable rhel-10.2 and centos repos for rhel-9.8 builds
43- for repo in /etc/yum.repos.d/{ocp,git}.repo; do
44- [ -f " $repo " ] && sed -i -E ' /^\[(rhel-10\.2|c10s)/,/^$/s/^enabled=1$/enabled=0/g' " $repo "
45- done
46- elif [ " $VERSION_ID " = " 10.2" ]; then
47- # Disable rhel-9 and centos repos for rhel-10.2 builds
48- for repo in /etc/yum.repos.d/{ocp,git}.repo; do
49- [ -f " $repo " ] && sed -i -E ' /^\[(rhel-9|c10s)/,/^$/s/^enabled=1$/enabled=0/g' " $repo "
50- done
51- fi
52- elif [ " $ID " = " centos" ] && [ " $VERSION_ID " = " 10" ]; then
53- # Disable rhel repos for centos-10 builds
54- for repo in /etc/yum.repos.d/{ocp,git}.repo; do
55- [ -f " $repo " ] && sed -i -E ' /^\[rhel-/,/^$/s/^enabled=1$/enabled=0/g' " $repo "
56- done
57- fi
35+ # Version lock to the specific packages installed on the system already
36+ dnf --disablerepo=* versionlock add ' *'
5837
59- # Install the OCP packages. Repos have been configured above .
60- rpm-ostree install \
38+ # Install the OCP packages. Limit to appropriate repos for this stream .
39+ dnf --disablerepo= * --enablerepo= " ${YUM_REPO_NAMES} " install -y \
6140 cri-o cri-tools conmon-rs \
6241 openshift-clients openshift-kubelet \
6342 openvswitch3.5 \
@@ -67,6 +46,14 @@ rpm-ostree install \
6746 ose-gcp-gcr-image-credential-provider \
6847 ose-crio-credential-provider
6948
49+ # clear the versionlock and clean up any dnf caches / yum repo files we created.
50+ # note `redhat.repo` gets created when you run dnf (via subscription-manager plugin),
51+ # so we'll clean that up too.
52+ dnf --disablerepo=* versionlock clear
53+ dnf clean all
54+ rm -vf /etc/yum.repos.d/{ocp,git,redhat}.repo
55+
56+
7057# --- postprocess steps ---
7158# These were previously in the `postprocess` section of packages-openshift.yaml.
7259
149136
150137# --- end postprocess steps ---
151138
152- # cleanup any repo files we injected
153- rm -f /etc/yum.repos.d/{ocp,git,okd}.repo
154-
155139find /usr -name ' *.pyc.bak' -exec sh -c ' mv $1 ${1%.bak}' _ {} \;
156140ostree container commit
0 commit comments