-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
executable file
·44 lines (35 loc) · 1.09 KB
/
deploy
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
#!/usr/bin/env bash
if [ "$#" -lt 2 ]; then
echo "Usage: $0 ENVIRONMENT IMAGE_TAG" >&2
exit 1
fi
# exit on any failing command
set -e
environment_name=$1
image_tag=$2
app_version="${image_tag}-`date -u +%s`"
extra_args=${@:3}
if [ -n "$DEPLOY_RESOURCE_PREFIX" ]; then
resource_prefix=${DEPLOY_RESOURCE_PREFIX}-
else
resource_prefix=""
fi
# common call
source $(dirname $(realpath ${0}))/load_environment_config
environment_values=`echo "$config" | jq -r ".environments[\"${environment_name}\"].values | map(\"${runtime_dir}/values/\" + .) | join(\",\")"`
if [ "${environment_encryption_key}" != "null" ]; then
environment_values="${environment_values} --set encryptionKey=${environment_encryption_key}"
fi
helm upgrade \
${release} \
${chart_arg} \
-n ${environment_namespace} \
--install \
--values $environment_values \
--set image.tag=${image_tag} \
--set appVersion=${app_version} \
--set resourcePrefix=${resource_prefix} \
${extra_args}
if [ "$extra_args" == '' ] || [ -n "$DEPLOY_TRACK" ]; then
${tools_dir}/track_helm_deployment ${release} ${environment_namespace}
fi