mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 07:48:14 +01:00
Added error check.
Added error check so that instead of breaking, if containers cant be checked on the registry (eg. locally built or deprecated) they'll be added to a error-list.
This commit is contained in:
parent
d5afc8f402
commit
8f95ac0305
1 changed files with 13 additions and 4 deletions
17
dockcheck.sh
17
dockcheck.sh
|
|
@ -63,11 +63,16 @@ 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")
|
||||
if [[ "$LocalHash" != "$RegHash" ]] ; then
|
||||
GotUpdates+=("$i")
|
||||
RegHash=$($regbin 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
|
||||
NoUpdates+=("$i")
|
||||
fi
|
||||
else
|
||||
NoUpdates+=("$i")
|
||||
GotErrors+=("$i")
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
@ -80,6 +85,10 @@ if [ -n "$GotUpdates" ] ; then
|
|||
printf "\n\033[31;1mContainers with updates available:\033[0m\n"
|
||||
printf "%s\n" "${GotUpdates[@]}"
|
||||
fi
|
||||
if [ -n "$GotErrors" ] ; then
|
||||
printf "\n\033[33;1mContainers with errors, wont get updated:\033[0m\n"
|
||||
printf "%s\n" "${GotErrors[@]}"
|
||||
fi
|
||||
|
||||
### Optionally get updates if there's any
|
||||
if [ -n "$GotUpdates" ] ; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue