-
Notifications
You must be signed in to change notification settings - Fork 0
/
oc-process.sh
executable file
·98 lines (63 loc) · 1.63 KB
/
oc-process.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
i="all"
f="template.yml"
e=".env"
while getopts ":f:e:i::" flag; do
case $flag in
f) f=${OPTARG} ;;
e) e=${OPTARG} ;;
i) i=${OPTARG} ;;
esac
done
set -a
source ./$e
set +a
BRANCH=$(git symbolic-ref --short -q HEAD)
# If not in main, assume dev
if [ "$BRANCH" != "main" ]; then
HOST=$HOST_DEV
MYSQL_PASSWORD=$MYSQL_PASSWORD_DEV
ITSYSTEM=$ITSYSTEM_DEV
fi
if [ $i = "volume" ]; then
ITEM=".items[0]"
elif [ $i = "config" ]; then
ITEM=".items[1]"
elif [ $i = "secrets" ]; then
ITEM=".items[2]"
elif [ $i = "deploy-app" ]; then
ITEM=".items[3]"
elif [ $i = "deploy-db" ]; then
ITEM=".items[4]"
elif [ $i = "service-app" ]; then
ITEM=".items[5]"
elif [ $i = "service-db" ]; then
ITEM=".items[6]"
elif [ $i = "route" ]; then
ITEM=".items[7]"
elif [ $i = "job" ]; then
ITEM=".items[8]"
elif [ $i = "all" ]; then
ITEM=""
else
echo "Object not found"
exit 1
fi
FINBIF_API_TOKEN=$(echo -n $FINBIF_API_TOKEN | base64)
MYSQL_PASSWORD=$(echo -n $MYSQL_PASSWORD | base64)
FLASK_SECRET_KEY=$(echo -n $FLASK_SECRET_KEY | base64)
RCLONE_ACCESS_KEY_ID=$(echo -n $RCLONE_ACCESS_KEY_ID | base64)
RCLONE_SECRET_ACCESS_KEY=$(echo -n $RCLONE_SECRET_ACCESS_KEY | base64)
echo "# $(oc project species-challenge)"
oc process -f $f \
-p BRANCH="$BRANCH" \
-p HOST="$HOST" \
-p MYSQL_PASSWORD="$MYSQL_PASSWORD" \
-p MYSQL_USER="$MYSQL_USER" \
-p MYSQL_DATABASE="$MYSQL_DATABASE" \
-p FINBIF_API_TOKEN="$FINBIF_API_TOKEN" \
-p FLASK_SECRET_KEY="$FLASK_SECRET_KEY" \
-p ITSYSTEM="$ITSYSTEM" \
-p RCLONE_ACCESS_KEY_ID="$RCLONE_ACCESS_KEY_ID" \
-p RCLONE_SECRET_ACCESS_KEY="$RCLONE_SECRET_ACCESS_KEY" \
| jq $ITEM