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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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