From e1350f0812b3e8491b3aa12ad331aae0bc5c9407 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sun, 20 Oct 2024 22:30:31 -0300 Subject: [PATCH] Implements Validation of Dependencies --- deploy.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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