Skip to content

Instantly share code, notes, and snippets.

@jgato
Created April 19, 2023 09:53
Show Gist options
  • Save jgato/36a2ac285534895fe047980a263e1aa7 to your computer and use it in GitHub Desktop.
Save jgato/36a2ac285534895fe047980a263e1aa7 to your computer and use it in GitHub Desktop.
Get the RHCOS version for each OCP version
#!/bin/bash
if [ -z "$CHANNEL" ]
then
echo Provide the channel via \'export CHANNEL=stable-4.x\'
exit 1
fi
rm -f version_maps &> /dev/null
VERSIONS=$(curl -sH 'Accept: application/json' "https://api.openshift.com/api/upgrades_info/v1/graph?channel=${CHANNEL}" | jq '.nodes[].version' -r)
for VERSION in ${VERSIONS}
do
RHCOSVERSION="$(oc adm release info "${VERSION}" -o 'jsonpath={.displayVersions.machine-os.Version}')"
echo "$VERSION - $RHCOSVERSION" | tee -a ./version_maps
done
echo OpenShift to RHCOS version mapping is in 'version_map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment