Skip to content

Commit

Permalink
fix(operator installation): fix OCP version detection on clusterbot r…
Browse files Browse the repository at this point in the history
…osa; throw error when umoci is not installed, with installation call to action (#490)

Signed-off-by: RHDH Build (rhdh-bot) <[email protected]>
Co-authored-by: RHDH Build (rhdh-bot) <[email protected]>
  • Loading branch information
nickboldt and rhdh-bot authored Nov 30, 2024
1 parent e9c3eef commit c08f96c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .rhdh/scripts/install-rhdh-catalog-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ fi

# log into your OCP cluster before running this or you'll get null values for OCP vars!
OCP_VER="v$(oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s#([0-9]+\.[0-9]+)\..+#\1#")"
if [[ $OCP_VER == "vnull" ]]; then # try releaseClientVersion = 4.16.14
OCP_VER="v$(oc version -o json | jq -r '.releaseClientVersion' | sed -r -e "s#([0-9]+\.[0-9]+)\..+#\1#")"
fi
OCP_ARCH="$(oc version -o json | jq -r '.serverVersion.platform' | sed -r -e "s#linux/##")"
if [[ $OCP_ARCH == "amd64" ]]; then OCP_ARCH="x86_64"; fi
# if logged in, this should return something like latest-v4.12-x86_64
Expand Down Expand Up @@ -225,11 +228,6 @@ function install_hosted_control_plane_cluster() {
# to the underlying nodes, causing an issue mirroring internal images effectively.
# This function works around this by locally modifying the bundles (replacing all refs to the internal registries
# with their mirrors on quay.io), rebuilding and pushing the images to the internal cluster registry.
if [[ ! $(command -v umoci) ]]; then
errorf "Please install umoci 0.4+. See https://github.com/opencontainers/umoci"
exit 1
fi

mkdir -p "${TMPDIR}/rhdh/rhdh" >&2
echo "[DEBUG] Rendering IIB $UPSTREAM_IIB as a local file..." >&2
opm render "$UPSTREAM_IIB" --output=yaml > "${TMPDIR}/rhdh/rhdh/render.yaml"
Expand Down Expand Up @@ -352,6 +350,10 @@ fi
newIIBImage=${IIB_IMAGE}
if [[ "${IS_HOSTED_CONTROL_PLANE}" = "true" ]]; then
echo "[INFO] Detected a cluster with a hosted control plane"
if [[ ! $(command -v umoci) ]]; then
errorf "Please install umoci 0.4+. See https://github.com/opencontainers/umoci?tab=readme-ov-file#install"
exit 1
fi
newIIBImage=$(install_hosted_control_plane_cluster)
else
newIIBImage=$(install_regular_cluster)
Expand Down

0 comments on commit c08f96c

Please sign in to comment.