-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·63 lines (56 loc) · 1.3 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
#!/bin/bash
set -eu;
##
## build command
##
COMMAND="hadolint"
if [[ -n "${PLUGIN_FORMAT:-}" ]]; then
COMMAND="$COMMAND --format=$PLUGIN_FORMAT"
fi
if [[ -n "${PLUGIN_FAILURE_THRESHOLD:-}" ]]; then
COMMAND="$COMMAND --failure-threshold=$PLUGIN_FAILURE_THRESHOLD"
else
COMMAND="$COMMAND --failure-threshold=style"
fi
if [[ "${PLUGIN_STRICT_LABELS:-}" == "true" ]]; then
COMMAND="$COMMAND --strict-labels"
fi
if [[ "${PLUGIN_VERBOSE:-}" == "true" ]]; then
COMMAND="$COMMAND --verbose"
fi
if [[ "${PLUGIN_DISABLE_IGNORE_PRAGMA:-}" == "true" ]]; then
COMMAND="$COMMAND --disable-ignore-pragmal"
fi
if [[ "${PLUGIN_NO_COLOR:-}" == "true" ]]; then
COMMAND="$COMMAND --no-color"
fi
if [[ "${PLUGIN_NO_FAIL:-}" == "true" ]]; then
COMMAND="$COMMAND --no-fail"
fi
# custom args, e.g. docker run --rm --volume=$(pwd):$(pwd) --workdir=$(pwd) --env=CI=test kokuwaio/hadolint --format=json
if [[ -n "${1:-}" ]]; then
COMMAND="$COMMAND $*"
fi
##
## collect files
##
FILES=$(find "$(pwd)" -type f \
\( -name 'Dockerfile' \
-o -name 'Containerfile' \) \
-not -path '*/node_modules/*')
if [[ ! "$FILES" ]]; then
echo "No files found!"
exit 1
fi
for FILE in ${FILES}; do
COMMAND="$COMMAND \n $FILE"
done
##
## evecute command
##
if [[ -n "${CI:-}" ]]; then
echo "$COMMAND"
else
echo "${COMMAND//\\n/}"
fi
eval "${COMMAND//\\n/}"