-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy
executable file
·46 lines (38 loc) · 1.07 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
45
46
#!/usr/bin/env bash
set -o nounset -o errexit
PROJ_NAME="configgin"
usage() {
cat <<EOF
Usage: $0 <master|check> [config]
Config is production by default. If it is given, the pipeline will be named
${PROJ_NAME}-master-<thing> instead.
EOF
}
target=""
while getopts '?t:' arg ; do
case $arg in
t) target="${OPTARG}" ; shift 2;;
?) usage ; exit ;;
esac
done
variant="${1:-}"
config="${2:-production}"
suffix="${2:+-${2:-}}"
if test -z "${config}" -o ! -r "config-${config}.yaml" ; then
exec >&2
echo "Failed to find configuration file config-${config}.yaml"
usage
exit 1
fi
alt_secrets_file="CONCOURSE_SECRETS_FILE_${config//-/_}"
if test -n "${!alt_secrets_file:-}" -a -r "${!alt_secrets_file:-}" ; then
CONCOURSE_SECRETS_FILE="${!alt_secrets_file:-}"
fi
fly set-pipeline \
${target:+"--target=${target}"} \
--pipeline="${PROJ_NAME}-${variant}${suffix}" \
--config="${PROJ_NAME}-${variant}.yaml" \
--load-vars-from=<(
gpg --decrypt --batch --quiet "${CONCOURSE_SECRETS_FILE}"
cat "config-${config}.yaml"
)