Skip to content

Commit

Permalink
Pass --cache-dir as global argument to Trivy (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlaurin committed May 27, 2021
1 parent 09b815c commit ac8de07
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ if [ $input ]; then
fi
ignoreUnfixed=$(echo $ignoreUnfixed | tr -d '\r')

GLOBAL_ARGS=""
if [ $cacheDir ];then
GLOBAL_ARGS="$GLOBAL_ARGS --cache-dir $cacheDir"
fi

ARGS=""
if [ $format ];then
ARGS="$ARGS --format $format"
Expand Down Expand Up @@ -89,9 +94,6 @@ if [ $skipDirs ];then
ARGS="$ARGS --skip-dirs $i"
done
fi
if [ $cacheDir ];then
ARGS="$ARGS --cache-dir $cacheDir"
fi
if [ $timeout ];then
ARGS="$ARGS --timeout $timeout"
fi
Expand All @@ -100,4 +102,5 @@ if [ $ignorePolicy ];then
fi

echo "Running trivy with options: " --no-progress "${ARGS}" "${artifactRef}"
trivy ${scanType} --no-progress $ARGS ${artifactRef}
echo "Global options: " "${GLOBAL_ARGS}"
trivy $GLOBAL_ARGS ${scanType} --no-progress $ARGS ${artifactRef}

0 comments on commit ac8de07

Please sign in to comment.