-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·114 lines (91 loc) · 2.5 KB
/
run.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env sh
set -eu
# Path to current directory
SCRIPT_DIR="$(dirname "$0")"
# Make sure HELM_BIN is set (normally by the helm command)
HELM_BIN="${HELM_BIN:-helm}"
# shellcheck source=scripts/lib/log.sh
. "${SCRIPT_DIR}/lib/log.sh"
# shellcheck source=scripts/lib/is_help.sh
. "${SCRIPT_DIR}/lib/is_help.sh"
# shellcheck source=scripts/lib/file_uri_substitution.sh
. "${SCRIPT_DIR}/lib/file_uri_substitution.sh"
# shellcheck source=scripts/lib/repository.sh
. "${SCRIPT_DIR}/lib/repository.sh"
# shellcheck source=scripts/lib/file.sh
. "${SCRIPT_DIR}/lib/file.sh"
_trap_hook() {
true
}
_trap() {
_trap_hook
}
trap _trap EXIT
usage() {
cat <<EOF
Repeatable configuration scheme for Helm Charts
This plugin provides a convenient way to manage a set of configuration scheme
And allow to use those defined scheme in your chart operations
Available Commands:
add Create a new configuration scheme
edit Edit a configuration scheme
list List existing configuration scheme
remove Remove a configuration scheme
view View a configuration scheme
Configuration scheme usage with : 'config://<scheme-name>'
EOF
}
_parent_process_command() {
if [ "$(uname)" = "Darwin" ]; then
ps -p "${PPID}" -o command=
elif [ "$(uname)" = "Linux" ]; then
if [ -f /proc/${PPID}/cmdline ]; then
xargs -0 </proc/${PPID}/cmdline
echo
else
ps -p "${PPID}" -o command=
fi
fi
}
while true; do
case "${1:-}" in
add | edit | list | remove | view)
# shellcheck disable=SC1090
. "${SCRIPT_DIR}/commands/${1}.sh"
if is_help "${2:-}"; then
"${1}_usage"
exit 0
fi
"${@}"
break
;;
downloader)
# command certFile keyFile caFile full-URL
if [ $# -le 4 ]; then
log_error "[downloader] invalid usage, please refer to https://helm.sh/docs/topics/plugins/#downloader-plugins"
exit 1
fi
# shellcheck source=scripts/commands/downloader.sh
. "${SCRIPT_DIR}/commands/downloader.sh"
# retrieve original helm command line
HELM_COMMAND="$(_parent_process_command)"
# It's always the 5th parameter
downloader "${5}" "${HELM_COMMAND}"
break
;;
--help | -h | help)
usage
break
;;
--quiet | -q)
# shellcheck disable=SC2034
QUIET=true
;;
"")
usage
exit 1
;;
esac
shift
done
exit 0