-
Notifications
You must be signed in to change notification settings - Fork 6
/
entrypoint.sh
executable file
·48 lines (46 loc) · 1.21 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
#!/bin/bash
set -e
while getopts "r:p:f:o:c:d:u:w:b:" o; do
case "${o}" in
r)
export imageRef="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
p)
export imagePath="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
f)
export format="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
o)
export output="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
c)
export returnCode="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
d)
export dbURL="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
u)
export dockerConfigDir="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
w)
export mode="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
b)
export dbPath="$(sed -e 's/^[ \t]*//'<<<"${OPTARG}")"
;;
esac
done
if [[ ${mode} = "update" ]]
then
clair-action update --db-path=${dbPath}
else
clair-action report \
--image-path=${GITHUB_WORKSPACE}/${imagePath} \
--image-ref=${imageRef} \
--docker-config-dir=${GITHUB_WORKSPACE}/${dockerConfigDir} \
--db-url=${dbURL} \
--db-path=${dbPath} \
--return-code=${returnCode} \
--format=${format} > ${output}
fi