Skip to content

Instantly share code, notes, and snippets.

@cwilkers
Created May 13, 2021 15:41
Show Gist options
  • Save cwilkers/12ecba5469a7d903d2e8fbc22930de73 to your computer and use it in GitHub Desktop.
Save cwilkers/12ecba5469a7d903d2e8fbc22930de73 to your computer and use it in GitHub Desktop.
script to download latest OpenShift development version CLI tools
#!/bin/bash
TARGETDIR=~/bin
VERSION=latest-4.8
URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp-dev-preview/${VERSION}"
pullsecret_file=~/openshift_pull.json
update_tool () {
TOOL=${1:-openshift-install}
curl -sLO ${URL}/${TOOL}-linux.tar.gz
tar xf ${TOOL}-linux.tar.gz
rm README.md ${TOOL}-linux.tar.gz
}
TMPDIR=$(mktemp -d)
pushd $TMPDIR
update_tool openshift-install
update_tool openshift-client
export RELEASE_IMAGE=$(curl -s ${URL}/release.txt | grep 'Pull From: quay.io' | awk -F ' ' '{print $3}')
./oc adm release extract --registry-config "${pullsecret_file}" \
--command=openshift-baremetal-install \
--to "${TMPDIR}" ${RELEASE_IMAGE}
mv ${TMPDIR}/{oc,openshift-install,kubectl,openshift-baremetal-install} $TARGETDIR
${TARGETDIR}/openshift-install version
${TARGETDIR}/oc version
popd
rmdir $TMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment