-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix-reuse-values.sh
executable file
·60 lines (46 loc) · 1.65 KB
/
fix-reuse-values.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#
# git clone https://github.com/Azure-Samples/openhack-devops-team/
#
# ./fix-reuse-values.sh ./ohteamvalues ./openhack-devops-team
#
if [ $# -ne 2 ]; then
echo "Need to specify path to values file and path to sources.
Example:
git clone https://github.com/Azure-Samples/openhack-devops-team/ ./ohsources
$0 ./ohteamvalues.txt ./ohsources"
exit 1
fi
VALUEFILE=$1
REPO=$2
echo "Using values from file \"${VALUEFILE}\""
echo "Using repo in directory \"${REPO}\""
# while getopts v:r: option
# do
# case "${option}"
# in
# v) VALUEFILE=${OPTARG};;
# r) REPO=${OPTARG};;
# esac
# done
ohteamvalues="$( cat "${VALUEFILE}" )"
declare -A charts=(
["api-poi"]="apis/poi/charts/mydrive-poi"
["api-trip"]="apis/trips/charts/mydrive-trips"
["api-user-java"]="apis/user-java/charts/mydrive-user-java"
["api-user"]="apis/userprofile/charts/mydrive-user"
)
echo "Cleaning Helm deployment for team \"$( echo "${ohteamvalues}" | egrep "^teamNumber$(printf '\t')" | awk '{print $2}' )\""
for chartName in "${!charts[@]}"; do
chartDir="${charts[$chartName]}"
endpoint="$( echo "${ohteamvalues}" | egrep "^endpoint$(printf '\t')" | awk '{print $2}' )"
acr="$( echo "${ohteamvalues}" | egrep "^ACR$(printf '\t')" | awk '{print $2}' )"
image="${acr}.azurecr.io/devopsoh/${chartName}"
echo "Deleting old chart ${chartName}"
helm delete --purge "${chartName}"
echo "Installing clean version of ${chartName}"
helm install "${REPO}/${chartDir}" --name "${chartName}" \
--set "repository.image=${image}" \
--set "env.webServerBaseUri=http://${endpoint}" \
--set "ingress.rules.endpoint.host=${endpoint}"
done