-
Notifications
You must be signed in to change notification settings - Fork 72
/
dev.sh
executable file
·66 lines (49 loc) · 1.16 KB
/
dev.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
#!/usr/bin/env bash
set -Eeuo pipefail
DEBUG=${DEBUG:-""}
if [[ -n "$DEBUG" ]]; then
set -x
fi
trap cleanup SIGINT SIGTERM ERR EXIT
# script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
source ./dev-scripts/utils.sh
source ./dev-scripts/compile.sh
source ./dev-scripts/build.sh
source ./dev-scripts/deploy.sh
usage() {
cmd=$(basename "${BASH_SOURCE[0]}")
cat <<EOF
Usage: $cmd command
This script is intended to help with compiling and deploying of dev enviroment
Available commands:
compile Compile the codebase
build Build a docker image
deploy Deploy the agent image
swarm Compile, build and deploy a swarm agent
podman Compile, build and deploy to a local podman agent
To get help with a command use: $cmd command -h
EOF
exit
}
# script cleanup here
cleanup() {
trap - SIGINT SIGTERM ERR EXIT
}
setup_colors
if [[ "${1-}" == "" ]]; then
usage
fi
case $1 in
compile | build | deploy)
"$1"_command "${@:2}"
;;
swarm)
deploy_command -s --ip 10.0.7.10 --ip 10.0.7.11 "${@:2}"
;;
podman)
deploy_command -p -c "${@:2}"
;;
*)
usage
;;
esac