Skip to content

Commit

Permalink
Merge pull request #2845 from dhellmann/USHIFT-2152-backport-dependen…
Browse files Browse the repository at this point in the history
…cy-repo-fix

[release-4.15] USHIFT-2152: look for dependency in rpm repo before trying to use it
  • Loading branch information
openshift-merge-bot[bot] authored Jan 5, 2024
2 parents cf39314 + 9f99545 commit 72eadde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
7 changes: 7 additions & 0 deletions scripts/devenv-builder/configure-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ if ${RHEL_SUBSCRIPTION}; then
sudo subscription-manager release --show
"${DNF_RETRY}" "clean" "all"
fi

# Enable RHEL CDN repos to avoid problems with incomplete RHUI mirrors
OSVERSION=$(awk -F: '{print $5}' /etc/system-release-cpe)
sudo subscription-manager config --rhsm.manage_repos=1
sudo subscription-manager repos \
--enable "rhel-${OSVERSION}-for-$(uname -m)-baseos-rpms" \
--enable "rhel-${OSVERSION}-for-$(uname -m)-appstream-rpms"
fi

if ${INSTALL_BUILD_DEPS} || ${BUILD_AND_RUN}; then
Expand Down
19 changes: 3 additions & 16 deletions scripts/get-latest-rhocp-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ if ! sudo subscription-manager status >&/dev/null; then
exit 1
fi

cacert="/etc/rhsm/ca/redhat-uep.pem"
cert=$(find /etc/pki/entitlement -iname '*.pem' -not -iname '*-key.pem')
key=$(find /etc/pki/entitlement -iname '*-key.pem')

# Get minor version of currently checked out branch.
# It's based on values stored in Makefile.version.$ARCH.var.
current_minor=$(cut -d'.' -f2 "${REPOROOT}/Makefile.version.$(uname -m).var")
Expand All @@ -35,18 +31,9 @@ stop=$(( current_minor - 3 ))
# and following code will try to access rhocp-4.15 (which is not released yet)
# and then rhocp-4.14 (which will be returned from the script because it's usable).
for ver in $(seq "${current_minor}" -1 "${stop}"); do
repository="https://cdn.redhat.com/content/dist/layered/rhel9/$(uname -m)/rhocp/4.${ver}"
exit_code=$(curl \
--silent \
--location \
--output /dev/null \
--write-out "%{http_code}" \
--cacert "${cacert}" \
--cert "${cert}" \
--key "${key}" \
"${repository}/os/repodata/repomd.xml")

if [[ "${exit_code}" == "200" ]]; then
repository="rhocp-4.${ver}-for-rhel-9-$(uname -m)-rpms"
if sudo dnf -v repository-packages "${repository}" info cri-o 1>&2;
then
echo "${ver}"
exit 0
fi
Expand Down

0 comments on commit 72eadde

Please sign in to comment.