Skip to content

Commit

Permalink
OCTOPUS-559: RHCOS image is out-of-date needs latest in cluster based…
Browse files Browse the repository at this point in the history
… on release not openshift-install

Signed-off-by: Paul Bastide <[email protected]>
  • Loading branch information
prb112 committed Nov 29, 2023
1 parent 606f964 commit bbb0880
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion modules/5_image/files/upload_rhcos_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,35 @@ ibmcloud plugin install -v 0.4.9 -f power-iaas
# Download the RHCOS qcow2
TARGET_DIR=".openshift/image-local"
mkdir -p ${TARGET_DIR}
DOWNLOAD_URL=$(openshift-install coreos print-stream-json | jq -r '.architectures.x86_64.artifacts.ibmcloud.formats."qcow2.gz".disk.location')

# Dev Note:
# Originally we used:
# openshift-install coreos print-stream-json | jq -r '.architectures.x86_64.artifacts.ibmcloud.formats."qcow2.gz".disk.location'
# However, this is not always consistent with the running cluster.
# We now generate the URL - https://rhcos.mirror.openshift.com/art/storage/prod/streams/4.15-9.2/builds/415.92.202309142014-0/x86_64/rhcos-415.92.202309142014-0-ibmcloud.x86_64.qcow2.gz

RHCOS_VERSION="4.15-9.2"
OCP_VERSION="$(oc adm release info -a ~/.openshift/pull-secret -o json | jq -r . | grep v4.15. | tr -d 'v",' | awk -F '=' '{print $2}')"
if [[ "${OCP_VERSION}" == *"4.15."* ]]
then
RHCOS_VERSION="4.15-9.2"
elif [[ "${OCP_VERSION}" == *"4.16."* ]]
then
# the 4.16 is just an example...
RHCOS_VERSION="4.16-9.3"
elif [[ "${OCP_VERSION}" == *"4.17."* ]]
then
RHCOS_VERSION="4.17-9.4"
elif [[ "${OCP_VERSION}" == *"4.18."* ]]
then
RHCOS_VERSION="4.18-9.4"
else
echo "unrecognized version for RHCOS"
exit 1
fi

RHCOS_BUILD=$(oc adm release info -a ~/.openshift/pull-secret -o json | jq -r '.displayVersions."machine-os".Version')
DOWNLOAD_URL="https://rhcos.mirror.openshift.com/art/storage/prod/streams/4.15-9.2/builds/${RHCOS_BUILD}/x86_64/rhcos-${RHCOS_BUILD}-ibmcloud.x86_64.qcow2.gz"
TARGET_GZ_FILE=$(echo "${DOWNLOAD_URL}" | sed 's|/| |g' | awk '{print $NF}')
TARGET_FILE=$(echo "${TARGET_GZ_FILE}" | sed 's|.gz||g')

Expand Down

0 comments on commit bbb0880

Please sign in to comment.