mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-11 18:46:34 +08:00
Add quickly compare feature
This commit is contained in:
@@ -13,6 +13,9 @@ DEBUG="${DEBUG:-}"
|
||||
# Allow image2 to have more tags than image1
|
||||
INCREMENTAL="${INCREMENTAL:-}"
|
||||
|
||||
# Compare only tags that are in both images
|
||||
QUICKLY="${QUICKLY:-}"
|
||||
|
||||
# Exclude tags that do not need to be checked
|
||||
EXCLUDED="${EXCLUDED:-}"
|
||||
|
||||
@@ -109,6 +112,17 @@ function diff-image-with-tag() {
|
||||
local image1="${1:-}"
|
||||
local image2="${2:-}"
|
||||
|
||||
if [[ "${QUICKLY}" == "true" ]]; then
|
||||
local tag1="${image1##*:}"
|
||||
local tag2="${image2##*:}"
|
||||
if [[ "${tag1}" != "${tag2}" ]]; then
|
||||
echo "${SELF}: UNSYNC: ${image1} and ${image2} are not in synchronized" >&2
|
||||
return 1
|
||||
fi
|
||||
echo "${SELF}: SYNC: ${image1} and ${image2} are in synchronized" >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
local inspect1="$(inspect ${image1})"
|
||||
local inspect2="$(inspect ${image2})"
|
||||
local diff_raw=$(diff --unified <(echo "${inspect1}") <(echo "${inspect2}"))
|
||||
|
Reference in New Issue
Block a user