From 05dbb892b62c94bd056c18ffb3064b5d007dda85 Mon Sep 17 00:00:00 2001 From: Mahe Tardy Date: Tue, 19 Nov 2024 10:18:36 -0700 Subject: [PATCH] digestcheck: take all arguments as grep input The exclude part wasn't working because it was only matching on the name of the file and not on the whole path, specifically the directory structure. Instead of using exclude-dir, let's just take the directory or the files directly as input so that the user can specify before which files needs to be included/excluded or not. Signed-off-by: Mahe Tardy --- contrib/digestcheck.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/digestcheck.sh b/contrib/digestcheck.sh index fc502159824..b897787338d 100755 --- a/contrib/digestcheck.sh +++ b/contrib/digestcheck.sh @@ -6,11 +6,12 @@ usage () { echo "might be available in order to improve compatibility." echo "" echo "Usage:" - echo -e "\t$0 (directory)" + echo -e "\t$0 (directory or files)" echo "" echo "Examples:" echo -e "\t$0 ." echo -e "\t$0 \$(git rev-parse --show-toplevel)" + echo -e "\tgit diff --name-only main | xargs $0" echo "" echo "Return value:" echo -e "\tOn overall success, the script returns 0. On error of any image" @@ -29,7 +30,7 @@ YELLOW=$(tput setaf 3) BLUE=$(tput setaf 4) NC=$(tput sgr0) -images=$(grep -n -r --include='*[dD]ockerfile*' --exclude='*vendor*' 'FROM' $1 | grep -E '\b\S+@\S+\b') +images=$(grep -n -r --include='*[dD]ockerfile*' 'FROM' "$@" | grep -E '\b\S+@\S+\b') exit_code=0