Skip to content

Commit

Permalink
digestcheck: take all arguments as grep input
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mtardy committed Nov 19, 2024
1 parent 1d48cc4 commit 05dbb89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contrib/digestcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down

0 comments on commit 05dbb89

Please sign in to comment.