diff --git a/deploy.sh b/deploy.sh index e61dc3f..c802636 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,6 +1,33 @@ #!/bin/sh +validate_dependencies() { + if ! command -v kubectl &> /dev/null; then + echo "kubectl could not be found" + exit 1 + fi + + if ! command -v helm &> /dev/null; then + echo "helm could not be found" + exit 1 + fi + + if ! command -v envsubst &> /dev/null; then + echo "envsubst could not be found" + exit 1 + fi + + if [[ $environment == "local" ]]; then + if ! command -v minikube &> /dev/null; then + echo "minikube could not be found" + exit 1 + fi + fi + + echo "Dependencies validated" +} + + read_env_file() { if [ -f $1 ]; then set -a && source $1 && set +a; @@ -204,6 +231,8 @@ while getopts ":f:e:mrh" opt; do esac done +validate_dependencies + if [[ $execution_mode == "deploy" ]]; then main elif [[ $execution_mode == "refresh" ]]; then