Last active
October 26, 2020 14:14
-
-
Save rjhowe/67a77417393f2bc94080a14d4916c575 to your computer and use it in GitHub Desktop.
OpenShift 4.x Release Viewer Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requires JQ installed. | |
# curl -sH 'Accept: application/json' https://api.openshift.com/api/upgrades_info/v1/graph?channel=stable-4.1&arch=amd64 | jq -S '.nodes | sort_by(.version)' | |
PS3='Please enter your choice: ' | |
# The names of the channels currently need to be hardcoded as there is no way to get a list of what current channels are avaiable. | |
# https://github.com/openshift/cincinnati/issues/171#issuecomment-555626636 | |
# Channels not listed prerelease-4.1 candidate-4.2 | |
#version=( "4.1" "4.2" "4.3" "4.4" "4.5") | |
version=( "4.3" "4.4" "4.5" "4.6") | |
channel=( "candidate" "fast" "stable" ) | |
mapfile -t options < <(for v in ${version[@]}; do for i in ${channel[@]}; do echo "$i-$v"; done; done) | |
# Now that there are channels fro archetures, might what to add an option for arch. | |
_Command () { | |
echo "Showing upgrade channel: ${channel}" | |
curl -sH 'Accept: application/json' "https://api.openshift.com/api/upgrades_info/v1/graph?channel=${channel}&arch=amd64" | jq -S '.nodes | sort_by(.version | gsub ("[a-z,A-Z,-]";"") | split(".") | map(tonumber)) | .[]' | |
} | |
if ! [ -x "$(command -v jq)" ]; then | |
echo 'Error: jq is not installed.' >&2 | |
exit 1 | |
fi | |
select opt in "${options[@]}" | |
do | |
channel="${opt}" | |
_Command | |
break | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment