Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a util to check dependencies and also fail if vars are not set. #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env bash
set -eou pipefail

source utils.sh

check_dependencies
mkdir -p outputs

# get params from config.json file
Expand Down
24 changes: 24 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
check_dependencies() {
local _DEP_FLAG _NEEDED

# check if the dependencies are installed
_NEEDED="az jq"
_DEP_FLAG=false

echo -e "Checking dependencies for the creation of the branches ...\n"
for i in ${_NEEDED}
do
if hash "$i" 2>/dev/null; then
# do nothing
:
else
echo -e "\t $_ not installed".
_DEP_FLAG=true
fi
done

if [[ "${_DEP_FLAG}" == "true" ]]; then
echo -e "\nDependencies missing. Please fix that before proceeding"
exit 1
fi
}
13 changes: 5 additions & 8 deletions walk-the-dog.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env bash

set -eou pipefail

mkdir -p outputs
export RG_NAME=$1
export LOCATION=$2
Expand Down Expand Up @@ -189,14 +193,7 @@ az ad sp create-for-rbac \
--cert $RG_NAME-cert \
--keyvault $KV_NAME \
--years 1

az ad sp create-for-rbac \
--name "http://sp-briantest.microsoft.com" \
--only-show-errors \
--create-cert \
--cert reddog-aks-4475-test-cert \
--keyvault reddog358briar4475 \
--years 1


## Get SP APP ID
echo 'Getting SP_APPID ...'
Expand Down