From ac8de07fd168680dd0331bef43681c0e150e9ad1 Mon Sep 17 00:00:00 2001 From: Valentin Laurin Date: Thu, 27 May 2021 17:03:06 +0100 Subject: [PATCH] Pass --cache-dir as global argument to Trivy (#51) --- entrypoint.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c47f31b..a4b06e8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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" @@ -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 @@ -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}