-
Notifications
You must be signed in to change notification settings - Fork 4
/
entrypoint.sh
executable file
·71 lines (61 loc) · 1.56 KB
/
entrypoint.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
#!/bin/sh -l
set -e
APP_PATH="/usr/local/bin/kusion"
echo "kusion version:"
$APP_PATH version
subcommand=$1
workDir=$2
settings=$3
arguments=$4
filenames=$5
yes=$6
detail=$7
noStyle=$8
dryRun=$9
diffs=${10}
params=$subcommand
if [ "$subcommand" = "apply" ] || [ "$subcommand" = "compile" ]; then
echo "input diffs: '$diffs'"
stacks=$(kclvm /diffs_to_stacks.py "${diffs}")
echo "all stacks: '$stacks'"
if [ ! -n "$stacks" ]; then
echo "no stacks to $subcommand"
exit 0
fi
if [ -n "$settings" ]; then
params="$params -Y $settings"
fi
if [ -n "$arguments" ]; then
params="$params $arguments"
fi
if [ -n "$filenames" ]; then
params="$params $filenames"
fi
if [ "$subcommand" = "apply" ]; then
if [ "$yes" = "true" ]; then
params="$params --yes"
fi
if [ "$detail" = "true" ]; then
params="$params --detail"
fi
if [ "$noStyle" = "true" ]; then
params="$params --no-style"
fi
if [ "$dryRun" = "true" ]; then
params="$params --dry-run"
fi
fi
if [ -n "$workDir" ]; then
params="$params -w $workDir"
else
echo "common params: $params"
echo "foreach stacks:"
for stack in $stacks; do
echo "---------------- Start -----------------"
echo "current stack is $stack"
echo "$APP_PATH $params -w $stack"
$APP_PATH $params -w $stack
echo "----------------- End ------------------"
done
fi
fi