bugquash-multidigest

Changed the logic in comparing the digests - if the local check had multiple digests for an image, the old logic would be inaccurate.
New logic just check if the newest digest is among the list of local digests, should avoid some false positives.
This commit is contained in:
mag37
2023-01-21 12:37:48 +01:00
committed by GitHub
parent 1f896cf794
commit d5fb9e3789

View File

@ -62,14 +62,14 @@ for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}')
do do
printf ". " printf ". "
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}') RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}' | sed -e 's/.*sha256/sha256/' -e 's/\]$//') LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')
RegHash=$($regbin image digest --list "$RepoUrl" 2>/dev/null) RegHash=$(./regctl image digest --list "$RepoUrl" 2>/dev/null)
# Check if regtcl produces errors - add to GotErrors if so. # Check if regtcl produces errors - add to GotErrors if so.
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
if [[ "$LocalHash" != "$RegHash" ]] ; then if [[ "$LocalHash" = *"$RegHash"* ]] ; then
GotUpdates+=("$i")
else
NoUpdates+=("$i") NoUpdates+=("$i")
else
GotUpdates+=("$i")
fi fi
else else
GotErrors+=("$i") GotErrors+=("$i")