-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·69 lines (67 loc) · 1.65 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
#!/usr/bin/env bash
set -e
set -o pipefail
echo ">>> Starting threatcl-action"
echo ">>> threatcl version"
bash -c "set -e; set -o pipefail; threatcl --version"
echo ""
if [ $1 = "validate" ]
then
echo ">>>> Running validate"
bash -c "set -e; set -o pipefail; threatcl validate $2"
elif [ $1 = "dashboard" ]
then
echo ">>>> Running dashboard"
additionaloptions=""
if [ "$4" != "" ]
then
additionaloptions="${additionaloptions} -dashboard-template=${4}"
fi
if [ "$5" != "" ]
then
additionaloptions="${additionaloptions} -dashboard-filename=${5}"
fi
if [ "$6" = "true" ]
then
additionaloptions="${additionaloptions} -dashboard-html"
fi
if [ "$7" != "" ]
then
additionaloptions="${additionaloptions} -threatmodel-template=${7}"
fi
if [ "$9" != "" ]
then
additionaloptions="${additionaloptions} -out-ext=${9}"
fi
bash -c "set -e; set -o pipefail; threatcl dashboard -overwrite -outdir=$3 $additionaloptions $2"
elif [ $1 = "dfd" ]
then
echo ">>>> Running dfd"
additionaloptions=""
if [ "$8" = "svg" ]
then
additionaloptions="-format=svg"
fi
if [ "$8" = "dot" ]
then
additionaloptions="-format=dot"
fi
bash -c "set -e; set -o pipefail; threatcl dfd -overwrite -outdir=$3 $additionaloptions $2"
elif [ $1 = "export" ]
then
echo ">>>> Running export"
additionaloptions=""
if [ "${10}" = "json" ]
then
additionaloptions="-format=json"
fi
if [ "${10}" = "otm" ]
then
additionaloptions="-format=otm"
fi
if [ "${10}" = "hcl" ]
then
additionaloptions="-format=hcl"
fi
bash -c "set -e; set -o pipefail; threatcl export -overwrite -output=${11} $additionaloptions $2"
fi