From 12adf9d3e78094eeb72b654d4ba00a2e58f28d62 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Wed, 13 Mar 2024 12:34:37 +0200 Subject: [PATCH] Install oc and virtctl binaries under /root/bin --- src/images/cloud-tools.Dockerfile | 1 + src/scripts/install-openshift-cli.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 src/scripts/install-openshift-cli.sh diff --git a/src/images/cloud-tools.Dockerfile b/src/images/cloud-tools.Dockerfile index 8c562d2..59402ba 100644 --- a/src/images/cloud-tools.Dockerfile +++ b/src/images/cloud-tools.Dockerfile @@ -36,6 +36,7 @@ ARG OSB_DNF_GROUPS="" COPY src/config/*.repo /etc/yum.repos.d/ RUN ./src/scripts/dnf.sh "${OSB_DNF_PACKAGES}" "${OSB_DNF_GROUPS}" RUN ./src/scripts/install-oci-cli.sh +RUN ./src/scripts/install-openshift-cli.sh RUN rm -rf /cloud-tools/src diff --git a/src/scripts/install-openshift-cli.sh b/src/scripts/install-openshift-cli.sh new file mode 100755 index 0000000..4e1463c --- /dev/null +++ b/src/scripts/install-openshift-cli.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -eox pipefail + +TEMPDIR=$(mktemp -d) + +# WARNING: these will only work on x86_64 + +# https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/getting-started-cli.html +curl -L --insecure https://downloads-openshift-console.apps.ocp-virt.prod.psi.redhat.com/amd64/linux/oc.tar --output-dir "$TEMPDIR" +# https://docs.openshift.com/container-platform/4.13/virt/virt-using-the-cli-tools.html +curl -L --insecure https://hyperconverged-cluster-cli-download-openshift-cnv.apps.ocp-virt.prod.psi.redhat.com/amd64/linux/virtctl.tar.gz --output-dir "$TEMPDIR" + +pushd "$TEMPDIR" +tar -xvf oc.tar +tar -xzvf virtctl.tar.gz +popd + +cp "$TEMPDIR/oc" /root/bin +cp "$TEMPDIR/virtctl" /root/bin + +chmod a+x /root/bin/*