Add GOROOT check for dev scripts. (#749)

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
pull/752/head
Oleksandr Andriienko 2021-04-01 09:24:04 +03:00 committed by GitHub
parent 2727aa5b5d
commit f41ac4dd4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -17,8 +17,9 @@ set -e
init() {
if [ -z "${BASE_DIR}" ]; then
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
BASE_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
fi
OPERATOR_DIR="$(dirname "${BASE_DIR}")"
}
check() {
@ -31,8 +32,13 @@ check() {
fi
local operatorVersion=$("${OPERATOR_SDK_BINARY}" version)
REQUIRED_OPERATOR_SDK=$(yq -r ".\"operator-sdk\"" "REQUIREMENTS")
REQUIRED_OPERATOR_SDK=$(yq -r ".\"operator-sdk\"" "${OPERATOR_DIR}/REQUIREMENTS")
[[ $operatorVersion =~ .*${REQUIRED_OPERATOR_SDK}.* ]] || { echo "operator-sdk ${REQUIRED_OPERATOR_SDK} is required"; exit 1; }
if [ -z "${GOROOT}" ]; then
echo "[ERROR] set up '\$GOROOT' env variable to make operator-sdk working"
exit 0
fi
}
updateFiles() {

View File

@ -37,6 +37,11 @@ case $OPERATOR_SDK_VERSION in
;;
esac
if [ -z "${GOROOT}" ]; then
echo "[ERROR] set up '\$GOROOT' env variable to make operator-sdk working"
exit 0
fi
OPERATOR_YAML="${BASE_DIR}"/../deploy/operator.yaml
NEW_OPERATOR_YAML="${OPERATOR_YAML}.new"