Skip to content

Commit

Permalink
Only install operator-sdk if not available local
Browse files Browse the repository at this point in the history
Signed-off-by: pjuarezd <[email protected]>
  • Loading branch information
pjuarezd committed Aug 5, 2023
1 parent 33c99e1 commit f6a2c33
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f6a2c33

Please sign in to comment.