-
Notifications
You must be signed in to change notification settings - Fork 163
/
gen-drone.sh
executable file
·47 lines (39 loc) · 1.23 KB
/
gen-drone.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
#!/usr/bin/env bash
. bin/common.sh
. bin/colors.sh
readonly enabled=$(yqr charts.drone.enabled || echo false)
[ "$enabled" != 'true' ] && exit
crypt
readonly template_path=$PWD/tpl/.drone.yml.gotmpl
readonly target_path=$ENV_DIR/.drone.yml
readonly branch=$(yqr charts.otomi-api.git.branch || echo 'main')
readonly cluster="$(yqr cluster.name)"
readonly customer=$(customer_name)
readonly global_pull_secret=$(yqr otomi.globalPullSecret)
readonly image_tag="$(otomi_image_tag)"
readonly provider=$(yqr alerts.drone)
pull_policy="always"
[ "${image_tag:0:1}" = "v" ] && pull_policy='if-not-exists'
target=$target_path
[ -n "$DRY_RUN" ] && target="/dev/stdout"
if [ "$provider" != '' ]; then
if [ "$provider" = 'slack' ]; then
key="url"
channel=$(yqr alerts.$provider.channel | echo dev-mon)
else
key="lowPrio"
fi
readonly webhook=$(yqr alerts.$provider.$key)
fi
printf "${COLOR_LIGHT_PURPLE}Creating $target_path ${COLOR_NC}\n"
cat $template_path | gucci \
-s imageTag="$image_tag" \
-s branch="$branch" \
-s cluster="$cluster" \
-s channel="$channel" \
-s customer="$customer" \
-s globalPullSecret="$global_pull_secret" \
-s provider="$provider" \
-s webhook="$webhook" \
-s pullPolicy="$pull_policy" \
>$target