From f6a2c33ad16c6b3cadb76294b9e3877dbedf41fd Mon Sep 17 00:00:00 2001 From: pjuarezd Date: Fri, 4 Aug 2023 19:37:04 -0600 Subject: [PATCH] Only install operator-sdk if not available local Signed-off-by: pjuarezd --- olm.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/olm.sh b/olm.sh index 84d3745037f..b26ccc644a8 100755 --- a/olm.sh +++ b/olm.sh @@ -7,18 +7,23 @@ OPERATOR_SDK_VERSION=v1.22.2 TMP_BIN_DIR="$(mktemp -d)" function install_binaries() { - - echo "Installing temporary Binaries into: $TMP_BIN_DIR"; - echo "Installing temporary operator-sdk binary: $OPERATOR_SDK_VERSION" - ARCH=`{ case "$(uname -m)" in "x86_64") echo -n "amd64";; "aarch64") echo -n "arm64";; *) echo -n "$(uname -m)";; esac; }` - OS=$(uname | awk '{print tolower($0)}') - OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/$OPERATOR_SDK_VERSION - curl -L ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH} -o ${TMP_BIN_DIR}/operator-sdk - OPERATOR_SDK_BIN=${TMP_BIN_DIR}/operator-sdk - chmod +x $OPERATOR_SDK_BIN + + operator-sdk version + if [ $? -ne 0 ]; then + echo "Installing temporary Binaries into: $TMP_BIN_DIR"; + echo "Installing temporary operator-sdk binary: $OPERATOR_SDK_VERSION" + ARCH=`{ case "$(uname -m)" in "x86_64") echo -n "amd64";; "aarch64") echo -n "arm64";; *) echo -n "$(uname -m)";; esac; }` + OS=$(uname | awk '{print tolower($0)}') + OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/$OPERATOR_SDK_VERSION + curl -L ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH} -o ${TMP_BIN_DIR}/operator-sdk + OPERATOR_SDK_BIN=${TMP_BIN_DIR}/operator-sdk + chmod +x $OPERATOR_SDK_BIN + else + OPERATOR_SDK_BIN="$(which operator-sdk)" + fi } -install_binaries + install_binaries # get the minio version minioVersionInExample=$(kustomize build examples/kustomization/tenant-openshift | yq eval-all '.spec.image' | tail -1)