Skip to content

Commit ac8de07

Browse files
authored
Pass --cache-dir as global argument to Trivy (#51)
1 parent 09b815c commit ac8de07

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

entrypoint.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ if [ $input ]; then
6161
fi
6262
ignoreUnfixed=$(echo $ignoreUnfixed | tr -d '\r')
6363

64+
GLOBAL_ARGS=""
65+
if [ $cacheDir ];then
66+
GLOBAL_ARGS="$GLOBAL_ARGS --cache-dir $cacheDir"
67+
fi
68+
6469
ARGS=""
6570
if [ $format ];then
6671
ARGS="$ARGS --format $format"
@@ -89,9 +94,6 @@ if [ $skipDirs ];then
8994
ARGS="$ARGS --skip-dirs $i"
9095
done
9196
fi
92-
if [ $cacheDir ];then
93-
ARGS="$ARGS --cache-dir $cacheDir"
94-
fi
9597
if [ $timeout ];then
9698
ARGS="$ARGS --timeout $timeout"
9799
fi
@@ -100,4 +102,5 @@ if [ $ignorePolicy ];then
100102
fi
101103

102104
echo "Running trivy with options: " --no-progress "${ARGS}" "${artifactRef}"
103-
trivy ${scanType} --no-progress $ARGS ${artifactRef}
105+
echo "Global options: " "${GLOBAL_ARGS}"
106+
trivy $GLOBAL_ARGS ${scanType} --no-progress $ARGS ${artifactRef}

0 commit comments

Comments
 (0)